mirror of
https://github.com/outbackdingo/scratchpkg.git
synced 2026-03-19 21:13:28 +00:00
updated
This commit is contained in:
17
buildpkg
17
buildpkg
@@ -247,14 +247,12 @@ packaging() {
|
||||
|
||||
purgefiles() {
|
||||
|
||||
if [ -f /etc/scratchpkg.conf.d/$PURGE_FILE ]; then
|
||||
for option in $(cat /etc/scratchpkg.conf.d/$PURGE_FILE); do
|
||||
for option in ${PURGE_FILE[@]}; do
|
||||
if [ -e $option ]; then
|
||||
msg2 "Purging $option..."
|
||||
rm -fr $option
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
strip_files() {
|
||||
@@ -468,13 +466,7 @@ main() {
|
||||
|
||||
. /usr/share/scratchpkg/functions || exit 1
|
||||
|
||||
### LOAD CONFIGURATION FILE ###
|
||||
if [ -f $CONF_FILE ]; then
|
||||
. $CONF_FILE
|
||||
else
|
||||
msg "${color_red}Configuration file not found.${color_reset}"
|
||||
exit 1
|
||||
fi
|
||||
loadconfigfile
|
||||
|
||||
parse_options "$@"
|
||||
|
||||
@@ -505,11 +497,6 @@ main() {
|
||||
|
||||
PKGNAME="$name#$version-$release.spkg.txz"
|
||||
|
||||
### SET NO STRIP ###
|
||||
#if [ $NO_STRIP ]; then
|
||||
# STRIP_PACKAGE="no"
|
||||
#fi
|
||||
|
||||
### UPDATE CHECKSUM ###
|
||||
if [ "$UPDATE_CHECKSUM" ]; then
|
||||
getsource
|
||||
|
||||
17
functions
17
functions
@@ -19,7 +19,6 @@ color_reset='\e[0m' #Reset color
|
||||
|
||||
### DECLARE SOME VALUE ###
|
||||
CONF_FILE="/etc/scratchpkg.conf"
|
||||
PURGE_FILE="purge"
|
||||
BUILD_SCRIPT="spkgbuild"
|
||||
|
||||
ROOT_DIR=/
|
||||
@@ -142,6 +141,22 @@ getpkginfofrompkg() {
|
||||
|
||||
}
|
||||
|
||||
loadconfigfile() {
|
||||
|
||||
if [ -f $CONF_FILE ]; then
|
||||
. $CONF_FILE
|
||||
PACKAGE_DIR=$(cat $CONF_FILE | grep ^'# PACKAGE_DIR' | tr -d '=' | tr -d '"' | cut -d ' ' -f 3-)
|
||||
SOURCE_DIR=$(cat $CONF_FILE | grep ^'# SOURCE_DIR' | tr -d '=' | tr -d '"' | cut -d ' ' -f 3-)
|
||||
WORK_DIR=$(cat $CONF_FILE | grep ^'# WORK_DIR' | tr -d '=' | tr -d '"' | cut -d ' ' -f 3-)
|
||||
PORT_REPO=$(cat $CONF_FILE | grep ^'# PORT_REPO' | tr -d '=' | tr -d '"' | cut -d ' ' -f 3-)
|
||||
PURGE_FILE=$(cat $CONF_FILE | grep ^'# PURGE_FILE' | tr -d '=' | tr -d '"' | cut -d ' ' -f 3-)
|
||||
else
|
||||
msg "${color_red}Configuration file not found.${color_reset}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
createtemplate() {
|
||||
|
||||
if [ -d $TEMPLATE_NAME ]; then
|
||||
|
||||
@@ -18,10 +18,8 @@ fi
|
||||
if [ ! -d $confdir ]; then
|
||||
mkdir -pv $confdir
|
||||
[ ! -f $confdir/scratchpkg.conf ] && cp -v scratchpkg.conf $confdir
|
||||
[ ! -d $confdir/scratchpkg.conf.d ] && cp -Rv scratchpkg.conf.d $confdir
|
||||
else
|
||||
[ ! -f $confdir/scratchpkg.conf ] && cp -v scratchpkg.conf $confdir || echo "$confdir/scratchpkg.conf exists"
|
||||
[ ! -d $confdir/scratchpkg.conf.d ] && cp -Rv scratchpkg.conf.d $confdir || echo "$confdir/scratchpkg.conf.d exists"
|
||||
fi
|
||||
|
||||
if [ ! -d $funcdir ]; then
|
||||
|
||||
@@ -303,13 +303,7 @@ main() {
|
||||
nocolor
|
||||
fi
|
||||
|
||||
### LOAD CONFIGURATION FILE ###
|
||||
if [ -f $CONF_FILE ]; then
|
||||
. $CONF_FILE
|
||||
else
|
||||
msg "${color_red}Configuration file not found.${color_reset}"
|
||||
exit 1
|
||||
fi
|
||||
loadconfigfile
|
||||
|
||||
### CHECK IF PACKAGE IS VALID PACKAGE ###
|
||||
#if [ ! $(tar -tf "$PACKAGE_INFO" | grep ".pkginfo") ]; then
|
||||
|
||||
@@ -174,13 +174,7 @@ main() {
|
||||
nocolor
|
||||
fi
|
||||
|
||||
### LOAD CONFIGURATION FILE ###
|
||||
if [ -f $CONF_FILE ]; then
|
||||
. $CONF_FILE
|
||||
else
|
||||
msg "${color_red}Configuration file not found.${color_reset}"
|
||||
exit 1
|
||||
fi
|
||||
loadconfigfile
|
||||
|
||||
### CHECK FOR ROOT ACCESS ###
|
||||
if [ "$UID" != "0" ]; then
|
||||
|
||||
80
scratch
80
scratch
@@ -24,8 +24,8 @@ run_installpkg() {
|
||||
pushtoport() {
|
||||
|
||||
for port in ${PORT_REPO[@]}; do
|
||||
if [ -d $PORT_DIR/$port/$PORTNAME ]; then
|
||||
pushd $PORT_DIR/$port/$PORTNAME
|
||||
if [ -d $port/$PORTNAME ]; then
|
||||
pushd $port/$PORTNAME
|
||||
if [ -d $INDEX_DIR/fakeroot ] && [ -d $INDEX_DIR/sudo ] && [ "$UID" != "0" ]; then
|
||||
fakeroot buildpkg
|
||||
if [ $? = 0 ]; then
|
||||
@@ -89,25 +89,26 @@ searchpkg() {
|
||||
|
||||
for port in ${PORT_REPO[@]}; do
|
||||
OUTPUT=()
|
||||
if [ -d $PORT_DIR/$port ]; then
|
||||
for list in $(ls $PORT_DIR/$port); do
|
||||
if [ -d $PORT_DIR/$port/$list ]; then
|
||||
if [ "$(cat $PORT_DIR/$port/$list/$BUILD_SCRIPT | grep ^'# description' | tr -d ':' | cut -d ' ' -f 3- | grep -i $SEARCH_PKG)" ] || [ "$(echo $list | grep -i $SEARCH_PKG)" ]; then
|
||||
if [ -d $port ]; then
|
||||
for list in $(ls $port); do
|
||||
if [ -f $port/$list/$BUILD_SCRIPT ]; then
|
||||
if [ "$(cat $port/$list/$BUILD_SCRIPT | grep ^'# description' | tr -d ':' | cut -d ' ' -f 3- | grep -i $SEARCH_PKG)" ] || [ "$(echo $list | grep -i $SEARCH_PKG)" ]; then
|
||||
OUTPUT+=($list)
|
||||
fi
|
||||
fi
|
||||
done
|
||||
for out in ${OUTPUT[@]}; do
|
||||
if [ -f $PORT_DIR/$port/$out/$BUILD_SCRIPT ]; then
|
||||
pushd $PORT_DIR/$port/$out
|
||||
if [ -f $port/$out/$BUILD_SCRIPT ]; then
|
||||
pushd $port/$out
|
||||
getpkginfo
|
||||
. $BUILD_SCRIPT
|
||||
popd
|
||||
if [ ! -z "$name" ] && [ ! -z "$version" ] && [ ! -z "$release" ]; then
|
||||
portname=$(basename $port)
|
||||
if [ -d $INDEX_DIR/$name ]; then
|
||||
msg "($port) ${color_green}$name${color_reset} $version-$release $description"
|
||||
msg "($portname) ${color_green}$name${color_reset} $version-$release $description"
|
||||
else
|
||||
msg "($port) $name $version-$release $description"
|
||||
msg "($portname) $name $version-$release $description"
|
||||
fi
|
||||
unset description
|
||||
fi
|
||||
@@ -203,8 +204,8 @@ showpackageinfo() {
|
||||
showdepends() {
|
||||
|
||||
for portdepends in ${PORT_REPO[@]}; do
|
||||
if [ -f $PORT_DIR/$portdepends/$PACKAGE_DEPENDS/$BUILD_SCRIPT ]; then
|
||||
pushd $PORT_DIR/$portdepends/$PACKAGE_DEPENDS
|
||||
if [ -f $portdepends/$PACKAGE_DEPENDS/$BUILD_SCRIPT ]; then
|
||||
pushd $portdepends/$PACKAGE_DEPENDS
|
||||
getpkginfo
|
||||
. $BUILD_SCRIPT
|
||||
popd
|
||||
@@ -222,7 +223,7 @@ showdepends() {
|
||||
else
|
||||
PORT_EXIST=no
|
||||
for port in ${PORT_REPO[@]}; do
|
||||
if [ -f $PORT_DIR/$port/$dep/$BUILD_SCRIPT ]; then
|
||||
if [ -f $port/$dep/$BUILD_SCRIPT ]; then
|
||||
PORT_EXIST=yes
|
||||
break
|
||||
fi
|
||||
@@ -240,7 +241,7 @@ showdepends() {
|
||||
else
|
||||
PORT_EXIST=no
|
||||
for port in ${PORT_REPO[@]}; do
|
||||
if [ -f $PORT_DIR/$port/$mdep/$BUILD_SCRIPT ]; then
|
||||
if [ -f $port/$mdep/$BUILD_SCRIPT ]; then
|
||||
PORT_EXIST=yes
|
||||
break
|
||||
fi
|
||||
@@ -257,8 +258,8 @@ showupdate() {
|
||||
|
||||
for package_name in $(ls $INDEX_DIR); do
|
||||
for port in ${PORT_REPO[@]}; do
|
||||
if [ -f $PORT_DIR/$port/$package_name/$BUILD_SCRIPT ]; then
|
||||
. $PORT_DIR/$port/$package_name/$BUILD_SCRIPT
|
||||
if [ -f $port/$package_name/$BUILD_SCRIPT ]; then
|
||||
. $port/$package_name/$BUILD_SCRIPT
|
||||
getinstalledname $name
|
||||
if [ "$name-$version-$release" != "$installedname" ]; then
|
||||
msg "$name ${color_red}$iversion-$irelease${color_reset} => ${color_green}$version-$release${color_reset}"
|
||||
@@ -297,10 +298,10 @@ showglobaldependent() {
|
||||
msg "Package ${color_red}$GLOBAL_PACKAGE_DEPENDENT${color_reset} not installed."
|
||||
fi
|
||||
for port in ${PORT_REPO[@]}; do
|
||||
if [ -d $PORT_DIR/$port ]; then
|
||||
for all in $(ls $PORT_DIR/$port); do
|
||||
if [ -f $PORT_DIR/$port/$all/$BUILD_SCRIPT ]; then
|
||||
depend=$(cat $PORT_DIR/$port/$all/$BUILD_SCRIPT | grep ^'# depends' | tr -d ':' | cut -d " " -f3-)
|
||||
if [ -d $port ]; then
|
||||
for all in $(ls $port); do
|
||||
if [ -f $port/$all/$BUILD_SCRIPT ]; then
|
||||
depend=$(cat $port/$all/$BUILD_SCRIPT | grep ^'# depends' | tr -d ':' | cut -d " " -f3-)
|
||||
for dep in ${depend[@]}; do
|
||||
if [ $dep = $GLOBAL_PACKAGE_DEPENDENT ]; then
|
||||
if [ -d $INDEX_DIR/$all ]; then
|
||||
@@ -316,28 +317,6 @@ showglobaldependent() {
|
||||
done
|
||||
}
|
||||
|
||||
syncports() {
|
||||
|
||||
for port in ${PORT_REPO[@]}; do
|
||||
if [ -f /etc/scratchpkg.conf.d/ports/$port.git ]; then
|
||||
git_link=$(cat /etc/scratchpkg.conf.d/ports/$port.git)
|
||||
pushd $PORT_DIR
|
||||
if [ ! -d $port ]; then
|
||||
mkdir $port
|
||||
fi
|
||||
if [ -d $port/.git ]; then
|
||||
msg "Syncing ${color_green}$port${color_reset} from ${color_green}$git_link${color_reset}"
|
||||
(cd $port && git pull)
|
||||
else
|
||||
git clone $git_link
|
||||
fi
|
||||
popd
|
||||
else
|
||||
msg "No git file for ${color_yellow}$port${color_reset}."
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
interrupted() {
|
||||
echo ""
|
||||
msg "${color_yellow}Interrupted!${color_reset}"
|
||||
@@ -366,9 +345,6 @@ parse_options() {
|
||||
-cu|--check-update)
|
||||
CHECK_UPDATE=yes
|
||||
;;
|
||||
--sync)
|
||||
SYNC_PORTS=yes
|
||||
;;
|
||||
--no-color)
|
||||
NO_COLOR=yes
|
||||
;;
|
||||
@@ -463,19 +439,7 @@ main() {
|
||||
nocolor
|
||||
fi
|
||||
|
||||
### LOAD CONFIGURATION FILE ###
|
||||
if [ -f $CONF_FILE ]; then
|
||||
. $CONF_FILE
|
||||
else
|
||||
msg "${color_red}Configuration file not found.${color_reset}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
### SYNC PORTS ###
|
||||
if [ $SYNC_PORTS ]; then
|
||||
syncports
|
||||
exit 0
|
||||
fi
|
||||
loadconfigfile
|
||||
|
||||
### CREATE PORT TEMPLATE ###
|
||||
if [ $TEMPLATE_NAME ]; then
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
### CONFIGURATION FOR SCRATCHPKG (A SIMPLE PACKAGE MANAGER FOR LINUX FROM SCRATCH) ###
|
||||
|
||||
export CFLAGS="-O2 -march=x86-64 -pipe"
|
||||
export CXXFLAGS="${CFLAGS}"
|
||||
export MAKEFLAGS="-j6"
|
||||
|
||||
export MAKEFLAGS='-j2'
|
||||
# PACKAGE_DIR = /var/spkg/packages
|
||||
# SOURCE_DIR = /var/spkg/sources
|
||||
# WORK_DIR = /tmp
|
||||
|
||||
PACKAGE_DIR=/usr/scratch/packages
|
||||
SOURCE_DIR=/usr/scratch/sources
|
||||
WORK_DIR=/usr/scratch/work
|
||||
PORT_DIR=/usr/scratch/ports
|
||||
# PORT_REPO = /home/emmett/github/scratchpkgPorts/lfs-stable/base
|
||||
# PORT_REPO = /home/emmett/github/scratchpkgPorts/lfs-stable/blfs
|
||||
# PORT_REPO = /home/emmett/github/scratchpkgPorts/lfs-stable/xorg
|
||||
# PORT_REPO = /home/emmett/github/scratchpkgPorts/extra
|
||||
|
||||
PORT_REPO="base blfs xorg extra tmp_ports"
|
||||
|
||||
STRIP_PACKAGE="yes"
|
||||
# PURGE_FILE = usr/share/locale
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
https://github.com/emmett1/base
|
||||
@@ -1 +0,0 @@
|
||||
https://github.com/emmett1/blfs
|
||||
@@ -1 +0,0 @@
|
||||
https://github.com/emmett1/extra
|
||||
@@ -1 +0,0 @@
|
||||
https://github.com/emmett1/xorg
|
||||
@@ -1 +0,0 @@
|
||||
usr/share/locale
|
||||
Reference in New Issue
Block a user