aboutsummaryrefslogtreecommitdiff
path: root/trunk/src/simplaret
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/src/simplaret')
-rwxr-xr-xtrunk/src/simplaret127
1 files changed, 73 insertions, 54 deletions
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