aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/common.sh14
-rwxr-xr-xsrc/jail-upgrade4
-rwxr-xr-xsrc/simplaret13
3 files changed, 24 insertions, 7 deletions
diff --git a/lib/common.sh b/lib/common.sh
index 5da1ed7..0749dd4 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -266,3 +266,17 @@ function eval_config {
}
+function default_version {
+
+ # get version from /etc/slackware-version
+ cat $1/etc/slackware-version | awk '{ print $2 }' | sed -e 's/.0$//'
+
+}
+
+function default_arch {
+
+ # get arch from /etc/slackware-version
+ cat $1/etc/slackware-version | awk '{ print $3 }' | sed -e 's/(//' -e 's/)//'
+
+}
+
diff --git a/src/jail-upgrade b/src/jail-upgrade
index fffc099..0c3d236 100755
--- a/src/jail-upgrade
+++ b/src/jail-upgrade
@@ -26,8 +26,8 @@ function jail_upgrade {
if [ "$SIMPLARET" == "simplaret" ]; then
- VERSION="`cat $1/etc/slackware-version | awk '{ print $2 }' | sed -e 's/.0$//'`"
- ARCH="`cat $1/etc/slackware-version | awk '{ print $3 }' | sed -e 's/(//' -e 's/)//'`"
+ VERSION="`default_version`"
+ ARCH="`default_arch`"
if [ -z "$ARCH" ]; then
ARCH="i386"
diff --git a/src/simplaret b/src/simplaret
index 9a7a64c..8bf18ca 100755
--- a/src/simplaret
+++ b/src/simplaret
@@ -16,7 +16,6 @@
# Place - Suite 330, Boston, MA 02111-1307, USA
#
-DEFAULT_VERSION="11.0"
SIMPLARET_CONF="/etc/simplepkg/simplepkg.conf"
REPOS_CONF="/etc/simplepkg/repos.conf"
COMMON="/usr/libexec/simplepkg/common.sh"
@@ -47,8 +46,8 @@ function simplaret_eval_config {
# simplaret config file evaluation
- DEFAULT_ARCH="`simplaret_eval_parameter DEFAULT_ARCH i386`"
- DEFAULT_VERSION="`simplaret_eval_parameter DEFAULT_VERSION $DEFAULT_VERSION`"
+ DEFAULT_ARCH="`simplaret_eval_parameter DEFAULT_ARCH $(default_arch)`"
+ DEFAULT_VERSION="`simplaret_eval_parameter DEFAULT_VERSION $(default_version)`"
STORAGE="`simplaret_eval_parameter STORAGE /var/simplaret/packages`"
PATCHES_DIR="`simplaret_eval_parameter PATCHES_DIR /var/simplaret/patches`"
PASSIVE_FTP="`simplaret_eval_parameter PASSIVE_FTP 0`"
@@ -505,8 +504,8 @@ function simplaret_get_jail_patches {
oldarch="$ARCH"
oldversion="$VERSION"
- VERSION="`cat $root/etc/slackware-version | awk '{ print $2 }' | sed -e 's/.0$//'`"
- ARCH="`cat $root/etc/slackware-version | awk '{ print $3 }' | sed -e 's/(//' -e 's/)//'`"
+ VERSION="`default_version`"
+ ARCH="`default_arch`"
# in case there's something wrong with the jail, abort
if [ -z "$VERSION" ] || [ -z "$ARCH" ]; then
@@ -592,6 +591,7 @@ function simplaret_install {
# download and install a package
# TODO: dependency checking
+ # TODO: also check if repository arch version matches target jail arch and version
local package root
@@ -604,6 +604,9 @@ function simplaret_install {
if [ "$?" == "0" ]; then
$root upgradepkg --install-new $package
+ else
+ echo "error: could not install package $package"
+ exit 1
fi
}