diff options
| -rw-r--r-- | trunk/Makefile | 2 | ||||
| -rw-r--r-- | trunk/doc/CHANGELOG | 28 | ||||
| -rw-r--r-- | trunk/lib/common.sh | 42 | ||||
| -rw-r--r-- | trunk/mkbuild/generic.mkSlackBuild | 18 | ||||
| -rw-r--r-- | trunk/mkbuild/model.mkbuild | 2 | ||||
| -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 | 
11 files changed, 247 insertions, 114 deletions
diff --git a/trunk/Makefile b/trunk/Makefile index 3dd668e..ff0583c 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -14,7 +14,7 @@  #  Place - Suite 330, Boston, MA 02111-1307, USA  # -VERSION = 0.6pre28 +VERSION = 0.6pre31  BUILD = 1rha  PREFIX = /usr  INSTALL = /usr/bin/install diff --git a/trunk/doc/CHANGELOG b/trunk/doc/CHANGELOG index 6202072..115959d 100644 --- a/trunk/doc/CHANGELOG +++ b/trunk/doc/CHANGELOG @@ -1,13 +1,41 @@  simplepkg changelog  =================== +0.6pre31 +======== + +    - generic.mkSlackBuild: config() on postinstall_script now accepts .dist +      and .sample config file extensions. +    - createpkg: +      - most clean -s option output +    - lspkg: fix on package search routine + +0.6pre30 +======== + +    - common.sh: fixed package_name when dealing with files under /var/log/packages + +0.6pre29 +======== + +    - templatepkg: fixed issue on adding files in a template. +    - simplaret: "--sync" and "sync" now synonyms to "--update" and "update". +  0.6pre28  ======== +    - generic.mkSlackBuild: new section copy_config_files +    - lspkg: change ls /var/log/packages/$1 to ...$1-[0-9] +    - mkjail: fixed #27 +    - jail-update: installs/remove packages according the template (closes #10) +    - simplaret: +      - option --install working for multiple packages (closes #1) +      - option --remove working for multiple packages      - mkpatch: fixed infinite loop on invalid diff action      - mkbuild 1.2.7:        - new ACTION bugfix        - search result bugfix +      - protect MKBUILD_NAME and ACTION variables with "" in line 266      - createpkg 1.1.13:        - severals EXIT_CODE corrections        - search result bugfix diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh index 0fe546c..06c19d7 100644 --- a/trunk/lib/common.sh +++ b/trunk/lib/common.sh @@ -27,7 +27,11 @@ SIMPLARET="simplaret"  function package_name { -  basename $1 .tgz | sed -e 's/-[^-]*-[^-]*-[^-]*$//' +  # get the package name +  # in some places (like in /var/log/packages), the package name is appended with +  # an -upgrade information that should be striped +  basename $1 .tgz | sed -e 's/-upgraded-[0-9]*-[0-9]*-[0-9]*,[0-9]*:[0-9]*:[0-9]*$//' \ +                         -e 's/-[^-]*-[^-]*-[^-]*$//'  } @@ -77,6 +81,7 @@ function install_packages {    fi    root="$JAIL_ROOT/$server" +  mkdir -p $root/var/log/packages    # now tries to install each package listed in the template    for pack in `cat $TEMPLATE | grep -v -e "^#" | cut -d : -f 1 | awk '{ print $1 }'`; do @@ -521,6 +526,35 @@ function update_template_files {  } +function update_jail_packages { + +  # update jail packages according the template +  # usage: update_jail_packages <jail-path> + +  # check if installed packages are listed in the template +  for pack in `ls -1 $1/var/log/packages/`; do +    pack=`package_name $pack` +    if ! `grep -v -e "^#" $TEMPLATE_BASE.template | cut -d : -f 1 | awk '{ print $1 }' | grep -q -e "^$pack\$"`; then +      ROOT=$1 removepkg $pack +    fi +  done + +  # check if each package from the template is installed +  grep -v -e "^#" $TEMPLATE_BASE.template | cut -d : -f 1 | awk '{ print $1 }' | while read pack; do + +    # check if the package is installed +    pack="`echo $pack | sed -e 's/\+/\\\+/'`" +    installed=`eval "ls /$1/var/log/packages/ | egrep -E '^$pack-[^-]+-[^-]+-[^-]+$'"` +    check=$? + +    if [ -z "$installed" ] || [ "$check" != "0" ]; then +      # the package isn't installed +      ROOT=$1 simplaret install $pack +    fi +  done + +} +  function copy_template_files {    # copy template files into jail @@ -735,6 +769,7 @@ function error_codes {    ERROR_MKBUILD_CONSTRUCTION=501    ERROR_MKBUILD_PROGRAM=502    ERROR_MKBUILD_INPUT_PAR=503 +  ERROR_MKBUILD_SVN=504    # Mkpatch error codes    ERROR_MKPATCH=600 @@ -815,9 +850,11 @@ function handle_error {        eecho $error "$BASENAME: Program logical error." ;;      $ERROR_MKBUILD_INPUT_PAR)        eecho $error "$BASENAME: Input parameter $2 error. See \"mkbuild --help\"." ;; -      $ERROR_MKPATCH)        eecho $error "$BASENAME: Mkpatch error. Check .mkbuild file." ;; +    $ERROR_MKBUILD_SVN) +      eecho $error "$BASENAME: SVN or empty URL. Disable this sections in .mkbuild file:\n - download_source;\n - md5sum_download_and_check_0;\n - md5sum_download_and_check_1;\n - gpg_signature_check\n - untar_source" +      ;;      #      # Others errors      *) @@ -953,4 +990,5 @@ function is_number {          (let int=$1)  2>/dev/null          return $? # Exit status of the let thread      fi +  } diff --git a/trunk/mkbuild/generic.mkSlackBuild b/trunk/mkbuild/generic.mkSlackBuild index 133c851..67776ea 100644 --- a/trunk/mkbuild/generic.mkSlackBuild +++ b/trunk/mkbuild/generic.mkSlackBuild @@ -305,6 +305,21 @@ mkdir -p $PKG/etc/rc.d  cp $CWD/rc.* $PKG/etc/rc.d/  </copy_init_scripts> +<copy_config_files> off +# Copy config files +mkdir -p $PKG/etc +for conf in [[CONFIG FILES]]; do +  mkdir -p $PKG/etc/`dirname $conf` +  if [ -e "$CWD/conf/$conf" ]; then +    cp -a $CWD/conf/$conf $PKG/etc/$conf +  elif [ -e "$CWD/$conf" ]; then +    cp -a $CWD/$conf $PKG/etc/$conf +  elif [ -e "$conf" ]; then +    cp -a $conf $PKG/etc/$conf +  fi +done +</copy_config_files> +  <install_documentation> off  # Install documentation  DOCS="[[DOCUMENTATION FILES]]" @@ -345,6 +360,9 @@ cat << EOSCRIPT > "$PKG/install/doinst.sh"  config() {    NEW="\$1"    OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)" +  OLD="\$(dirname \$NEW)/\$(basename \$OLD .sample)" +  OLD="\$(dirname \$NEW)/\$(basename \$OLD .dist)" +    # If there's no config file by that name, mv it over:    if [ ! -r \$OLD ]; then      mv \$NEW \$OLD diff --git a/trunk/mkbuild/model.mkbuild b/trunk/mkbuild/model.mkbuild index d030ea4..391b750 100644 --- a/trunk/mkbuild/model.mkbuild +++ b/trunk/mkbuild/model.mkbuild @@ -100,6 +100,7 @@  #[[SIGNING KEY]]=""  #[[SIGNING KEY URL]]=""  #[[SIGNING KEY ID]]="" +#[[SIGNING URL]]=""  #[[CONFIG FILES]]=""  #[[PATCH URLS]]=""  [[PATCH FILES]]="" @@ -141,6 +142,7 @@ off: patch_source  off: compress_manpages  off: compress_info_files  off: copy_init_scripts +off: copy_config_files   on: install_documentation   on: slackdesc  off: move_config_files 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  | 
