diff options
Diffstat (limited to 'trunk/src')
-rw-r--r-- | trunk/src/createpkg | 41 | ||||
-rwxr-xr-x | trunk/src/jail-update | 1 | ||||
-rwxr-xr-x | trunk/src/lspkg | 39 | ||||
-rwxr-xr-x | trunk/src/mkbuild | 45 | ||||
-rwxr-xr-x | trunk/src/simplaret | 127 | ||||
-rwxr-xr-x | trunk/src/templatepkg | 16 |
6 files changed, 158 insertions, 111 deletions
diff --git a/trunk/src/createpkg b/trunk/src/createpkg index 1dd568e..cf8e515 100644 --- a/trunk/src/createpkg +++ b/trunk/src/createpkg @@ -27,7 +27,7 @@ # Createpkg functions #--------------------------------------------------- -CREATEPKG_VERSION="1.1.13" +CREATEPKG_VERSION="1.1.15" function usage { @@ -308,7 +308,10 @@ case $1 in ;; '--search'|'-s') [ $# -ne 2 ] && usage # two parameters is required - find_slackbuild $2 + LIST=`find_slackbuild $2` + for i in $LIST; do + echo $i | sed 's/.*\/\([^\/]\+\)\.[Ss]lack[Bb]uild$/ \1/' + done exit $EXIT_CODE ;; '--info'|'-f') @@ -424,29 +427,17 @@ eecho $messag "$BASENAME: processing $SCRIPT_NAME" cd $SCRIPT_BASE # Run SlackBuild script -if [ $DEBUG -eq $off ]; then - ( - LANG=en_US \ - SRC_DIR=${SRC_DIR:=$SOURCE_DIR} \ - SRC=${SRC_DIR:=$SOURCE_DIR} \ - ARCH=${ARCH:=$CREATE_ARCH} \ - COLOR=${COLOR:=$COLOR_MODE} \ - REPOS=${REPOS:=$MAKEPKG_REPOS} \ - CLEANUP=${CLEANUP:=$CREATE_CLEANUP} \ - INTERACT=no sh +x ./$SCRIPT_NAME - ) -else - ( - LANG=en_US \ - SRC_DIR=${SRC_DIR:=$SOURCE_DIR} \ - SRC=${SRC_DIR:=$SOURCE_DIR} \ - ARCH=${ARCH:=$CREATE_ARCH} \ - COLOR=${COLOR:=$COLOR_MODE} \ - REPOS=${REPOS:=$MAKEPKG_REPOS} \ - CLEANUP=${CLEANUP:=$CREATE_CLEANUP} \ - INTERACT=no sh -x ./$SCRIPT_NAME - ) -fi +[ $DEBUG -eq $off ] && SHELL_FLAG="+x" || SHELL_FLAG="-x" +( + LANG=en_US \ + SRC_DIR=${SRC_DIR:=$SOURCE_DIR} \ + SRC=${SRC_DIR:=$SOURCE_DIR} \ + ARCH=${ARCH:=$CREATE_ARCH} \ + COLOR=${COLOR:=$COLOR_MODE} \ + REPOS=${REPOS:=$MAKEPKG_REPOS} \ + CLEANUP=${CLEANUP:=$CREATE_CLEANUP} \ + INTERACT=no sh $SHELL_FLAG ./$SCRIPT_NAME +) # Check if package was built handle_error $? $PACKAGE diff --git a/trunk/src/jail-update b/trunk/src/jail-update index c5a008f..ce2d165 100755 --- a/trunk/src/jail-update +++ b/trunk/src/jail-update @@ -56,6 +56,7 @@ elif [ ! -d "$1" ]; then fi update_template_files +update_jail_packages $1 copy_template_files $1 set_jail_perms $1 diff --git a/trunk/src/lspkg b/trunk/src/lspkg index e772fb3..ce7b3b9 100755 --- a/trunk/src/lspkg +++ b/trunk/src/lspkg @@ -18,6 +18,7 @@ # COMMON="/usr/libexec/simplepkg/common.sh" +PKG_LIST_DIR="var/log/packages" if [ -f "$COMMON" ]; then source $COMMON @@ -48,17 +49,22 @@ options are: # ----------------------------------------------------- if [ $# -eq 2 ]; then - LIST_PKGS="`ls /$ROOT/var/log/packages/$2-[0-9]* 2> /dev/null`" - if [ -z "$LIST_PKGS" ]; then - LIST_PKGS="`ls /$ROOT/var/log/packages/$2* 2> /dev/null`" - fi + pack=$2 elif [ $# -eq 1 ]; then - LIST_PKGS="`ls /$ROOT/var/log/packages/$1-[0-9]* 2> /dev/null`" - if [ -z "$LIST_PKGS" ]; then - LIST_PKGS="`ls /$ROOT/var/log/packages/$1* 2> /dev/null`" - fi + pack=$1 else - LIST_PKGS="`ls /$ROOT/var/log/packages/ 2> /dev/null`" + pack="" +fi + +if [ ! -z "$pack" ]; then + if echo $pack | grep -q "*"; then + LIST_PKGS="`ls -1 /$ROOT/$PKG_LIST_DIR/$pack 2> /dev/null`" + else + pack="`echo $pack | sed -e 's/\+/\\\+/'`" + LIST_PKGS=`eval "ls -1 /$ROOT/$PKG_LIST_DIR/ 2> /dev/null | egrep -E '^$pack-[^-]+-[^-]+-[^-]+$'"` + fi +else + LIST_PKGS="`ls /$ROOT/$PKG_LIST_DIR/ 2> /dev/null`" fi LIST_PKGS="`slash $LIST_PKGS`" @@ -71,14 +77,14 @@ case $1 in if [ ! -z "$2" ]; then if [ ! -z "$LIST_PKGS" ]; then for file in $LIST_PKGS; do - less $file + less /$PKG_LIST_DIR/$file done else if [ ! -z "$ROOT" ]; then - echo "$2: package not found on /$ROOT/var/log/packages" + echo "$2: package not found on /$ROOT/$PKG_LIST_DIR" exit 1 else - echo "$2: package not found on /var/log/packages" + echo "$2: package not found on /$PKG_LIST_DIR" exit 1 fi fi @@ -97,13 +103,13 @@ case $1 in "-r"|"--remove") if [ ! -z "$2" ]; then if [ ! -z "$LIST_PKGS" ]; then - removepkg /$ROOT/var/log/packages/$1-[0-9]* + removepkg /$ROOT/$PKG_LIST_DIR/$1-[0-9]* fi fi ;; "-s"|"--search") if [ ! -z "$2" ]; then - eval "grep -l '\/$2$' /$ROOT/var/log/packages/*" + eval "grep -l '\/$2$' /$ROOT/$PKG_LIST_DIR/*" fi ;; "-d"|"--description") @@ -125,12 +131,13 @@ case $1 in done else if [ ! -z "$ROOT" ]; then - echo "$1: package not found on /$ROOT/var/log/packages" + echo "$1: package not found on /$ROOT/$PKG_LIST_DIR" exit 1 else - echo "$1: package not found on /var/log/packages" + echo "$1: package not found on /$PKG_LIST_DIR" exit 1 fi fi ;; esac + diff --git a/trunk/src/mkbuild b/trunk/src/mkbuild index d961a53..d356d23 100755 --- a/trunk/src/mkbuild +++ b/trunk/src/mkbuild @@ -19,7 +19,7 @@ # Based in model generic.SlackBuild of Luiz # # Version: -PROG_VERSION=1.2.7 +PROG_VERSION=1.2.8 PROG_NAME=`basename $0` #-------------------------------------------------------------------- @@ -263,7 +263,7 @@ function set_parameters { shift done - [ ! -e $MKBUILD_NAME -a $ACTION == "build" ] && ACTION='new' + [ ! -e "$MKBUILD_NAME" -a "$ACTION" == "build" ] && ACTION='new' } @@ -367,6 +367,13 @@ function get_status { } +function get_mkbuild_status { + + # Get status from mkbuild file + # $1 section + eval "sed '/^#>>/,/<</ ! d; /^#/ d; /: *$1$/! d; s/^ *\(.*\):.*$/\1/' $MKBUILD_NAME" +} + function activate_sections { # Enable and desable sections @@ -377,14 +384,14 @@ function activate_sections { set_status $SECTION $STATUS $SLACKBUILD_TEMP done - if [ $SVN_MOD -eq $on -o $URL == "" ]; then - LIST_OFF="download_source md5sum_download_and_check_0 md5sum_download_and_check_1 gpg_signature_check untar_source" - [ $VERBOSE -eq $on ] && echo -e "\nSubversion or empty URL changes:" - for i in $LIST_OFF; do - set_status $i "off" $SLACKBUILD_TEMP - done - [ $SVN_MOD -eq $on ] && set_status svn_source "on" $SLACKBUILD_TEMP - fi + #if [ $SVN_MOD -eq $on -o $URL == "" ]; then + # LIST_OFF="download_source md5sum_download_and_check_0 md5sum_download_and_check_1 gpg_signature_check untar_source" + # [ $VERBOSE -eq $on ] && echo -e "\nSubversion or empty URL changes:" + # for i in $LIST_OFF; do + # set_status $i "off" $SLACKBUILD_TEMP + # done + # [ $SVN_MOD -eq $on ] && set_status svn_source "on" $SLACKBUILD_TEMP + #fi } @@ -778,7 +785,21 @@ if [ ! -z $MKBUILD_NAME ]; then # URL program URL=`validate_parameter "$URL" "DOWNLOAD FOLDER URL" ""` || handle_error $ERROR_MKBUILD_CONSTRUCTION "URL" [ $VERBOSE -eq $on ] && echo "[[URL]]=\"$URL\"" - [ $URL == "" ] || echo $URL | grep '^svn:\/\/' >/dev/null && SVN_MOD=$on + + AUX=`get_mkbuild_status "svn_source"` + SVN_MOD=`convert_boolean "$AUX"` + # Check sections + if [ $SVN_MOD -eq $on -o $URL == "" ]; then + LIST_OFF="download_source md5sum_download_and_check_0 md5sum_download_and_check_1 gpg_signature_check untar_source" + [ $VERBOSE -eq $on ] && echo -e "\nCheck subversion or empty URL" + for i in $LIST_OFF; do + if [ `get_mkbuild_status "$i"` != "off" ]; then + handle_error $ERROR_MKBUILD_SVN + else + [ $VERBOSE -eq $on ] && echo -e "off: $i is ok." + fi + done + fi STR_MOUNT="`echo $URL | sed 's/.*\.\([a-z0-9]\+\)$/\1/'`" if [ $STR_MOUNT = "gz" -o $STR_MOUNT = "tgz" -o $STR_MOUNT = "bz2" -o $STR_MOUNT = "zip" ]; then @@ -789,7 +810,7 @@ if [ ! -z $MKBUILD_NAME ]; then fi [ $VERBOSE -eq $on ] && echo "[[DOWNLOAD FOLDER URL]]=\"$URL_BASE\"" - if [ $SVN_MOD -ne $on ]; then + if [ $SVN_MOD -eq $off ]; then # Extension EXTENSION=`validate_parameter "$EXTENSION" "EXTENSION" "$STR_MOUNT"` || handle_error $ERROR_MKBUILD_CONSTRUCTION "EXTENSION" [ $VERBOSE -eq $on ] && echo "[[EXTENSION]]=\"$EXTENSION\"" diff --git a/trunk/src/simplaret b/trunk/src/simplaret index f0139c6..66bb1e1 100755 --- a/trunk/src/simplaret +++ b/trunk/src/simplaret @@ -30,7 +30,7 @@ fi function simplaret_usage { echo "usage: [ARCH=otherarch] [VERSION=otherversion] $BASENAME [OPTION] package-name" - echo -e "\t OPTIONS: --help, --install, --update, --upgrade, --search, --get, --get-patches, --purge, --remove" + echo -e "\t OPTIONS: --help, --install, --update (or --sync), --upgrade, --search, --get, --get-patches, --purge, --remove" exit 1 } @@ -907,70 +907,78 @@ function simplaret_checksum { function simplaret_install { # download and install a package - # usage: simplaret_install <package-name|package-file-name> [--skip-checks] + # usage: simplaret_install <package-name1|package-file-name1> ... [--skip-checks] local package root jail_arch jail_version slack_required dep dependency tmp local name version build - name="`package_name $1`" - - root="/$ROOT" - mkdir -p $root/var/log/setup/tmp + for package in $*; do - if [ "`echo $1 | sed -e 's/\(..\).*/\1/g'`" == "--" ]; then - echo $BASENAME: install: syntax error: expected package name - return 1 - fi + if [ "$package" == "--skip-checks" ]; then + continue + fi - # now we check if ARCH and VERSION from the - # repository are the same of the jail - if [ "$2" != "--skip-checks" ]; then - jail_arch="`default_arch $root`" - jail_version="`default_version $root`" - if [ "$ARCH" != "$jail_arch" ]; then - echo "$BASENAME: requested repository arch ($ARCH) doesn't match jail arch ($jail_arch)" - echo "$BASENAME: please use \"$BASENAME --get $1 --skip-checks\" to ignore this warning and install anyway" - return - elif [ "$VERSION" != "$jail_version" ]; then - echo "$BASENAME: requested repository version ($VERSION) doesn't match jail version ($jail_version)" - echo "$BASENAME: please use \"$BASENAME --get $1 --skip-checks\" to ignore this warning and install anyway" + name="`package_name $package`" + + root="/$ROOT" + mkdir -p $root/var/log/setup/tmp + + if [ "`echo $package | sed -e 's/\(..\).*/\1/g'`" == "--" ]; then + echo $BASENAME: install: syntax error: expected package name return 1 fi - fi - - # package="`simplaret_get $1 --silent`" - simplaret_get $1 --silent - package="$LAST_DOWNLOADED_PACKAGE" - - if [ "$package" != "0" ] && [ ! -z "$package" ]; then - slack_required="`dirname $package`/$name.slack-required" - if [ -f "$package" ]; then - - if [ -f "$slack_required" ] && [ "$DEPENDENCY_CHECKING" == "1" ]; then - # this routine checks for dependencies in package's slack-required - # procedure adapted from createpkg script - ( grep -v '^#' $slack_required | while read dep; do - if [ ! -z "$dep" ]; then - dependency="`echo $dep | awk '{ print $1 }'`" - simplaret_solve_dep $name $dependency $root - fi - true - done ) + + # now we check if ARCH and VERSION from the + # repository are the same of the jail + if ! echo $* | grep -q -- "--skip-checks"; then + jail_arch="`default_arch $root`" + jail_version="`default_version $root`" + if [ "$ARCH" != "$jail_arch" ]; then + echo "$BASENAME: requested repository arch ($ARCH) doesn't match jail arch ($jail_arch)" + echo "$BASENAME: please use \"$BASENAME --get $package --skip-checks\" to ignore this warning and install anyway" + return + elif [ "$VERSION" != "$jail_version" ]; then + echo "$BASENAME: requested repository version ($VERSION) doesn't match jail version ($jail_version)" + echo "$BASENAME: please use \"$BASENAME --get $package --skip-checks\" to ignore this warning and install anyway" + return 1 + fi + fi + + # package="`simplaret_get $package --silent`" + simplaret_get $package --silent + package="$LAST_DOWNLOADED_PACKAGE" + + if [ "$package" != "0" ] && [ ! -z "$package" ]; then + slack_required="`dirname $package`/$name.slack-required" + if [ -f "$package" ]; then + + if [ -f "$slack_required" ] && [ "$DEPENDENCY_CHECKING" == "1" ]; then + # this routine checks for dependencies in package's slack-required + # procedure adapted from createpkg script + ( grep -v '^#' $slack_required | while read dep; do + if [ ! -z "$dep" ]; then + dependency="`echo $dep | awk '{ print $package }'`" + simplaret_solve_dep $name $dependency $root + fi + true + done ) + fi + + ROOT=$root upgradepkg --install-new $package + LAST_DOWNLOADED_PACKAGE="0" + + else + echo "Error: could not install package $package: file not found" + LAST_DOWNLOADED_PACKAGE="0" + return 1 fi - - ROOT=$root upgradepkg --install-new $package - LAST_DOWNLOADED_PACKAGE="0" - else - echo "Error: could not install package $1: file not found" + echo "Error: could not install package $package" LAST_DOWNLOADED_PACKAGE="0" return 1 fi - else - echo "Error: could not install package $1" - LAST_DOWNLOADED_PACKAGE="0" - return 1 - fi + + done } @@ -1075,6 +1083,17 @@ function simplaret_solve_dep { } +function simplaret_remove { + + # remove packages + # usage: simplaret_remove <package1> [<package2> ... <packageN>] + + for package in $*; do + ROOT=/$ROOT removepkg $package + done + +} + function simplaret_req_arg { # requires arg @@ -1102,14 +1121,14 @@ fi BASENAME="`basename $0`[$SIMPLARET_CHILD]" case $1 in - "--update" | "update") simplaret_update ;; + "--update" | "update" | "--sync" | "sync" ) simplaret_update ;; "--upgrade" | "upgrade") simplaret_get_patches --upgrade ;; "--get-patches" | "get-patches") simplaret_get_patches ;; "--search" | "search") shift ; simplaret_req_arg $1 ; simplaret_search $* ;; "--get" | "get") shift ; simplaret_req_arg $1 ; simplaret_get $* ;; "--purge" | "purge") shift ; simplaret_req_arg $1 simplaret_purge $* ;; "--install" | "install") shift ; simplaret_req_arg $1 ; simplaret_install $* ;; - "--remove" | "remove") simplaret_req_arg $2 ; ROOT=/$ROOT removepkg $2 ;; + "--remove" | "remove") shift ; simplaret_req_arg $1 ; simplaret_remove $* ;; "--help" | "help") simplaret_usage ;; *) if echo $1 | grep -q -v '^--'; then diff --git a/trunk/src/templatepkg b/trunk/src/templatepkg index 4f2592f..a8045ee 100755 --- a/trunk/src/templatepkg +++ b/trunk/src/templatepkg @@ -479,10 +479,18 @@ function template_add { if use_svn && [ -d "$TEMPLATE_BASE.d/.svn" ]; then - if [ ! -d "$TEMPLATE_BASE.d/`dirname $file`/.svn" ]; then - mkdir -p $TEMPLATE_BASE.d/`dirname $file`/ - svn add $TEMPLATE_BASE.d/`dirname $file`/ - fi + candidate="./`dirname $file`" + mkdir -p $TEMPLATE_BASE.d/$candidate + cd $TEMPLATE_BASE.d/$candidate + while true; do + if [ -d ".svn" ]; then + svn add `basename $candidate` + break + else + candidate="`basename $(pwd)`" + cd .. + fi + done cp -a $jail/$file $destination |