commit 044eb279e137c9e1f5d34d97c4671140d9cd0c38
parent 651c477dbf580393556a8dd8d55b45795b56aa68
Author: Jaromil <jaromil@dyne.org>
Date: Wed, 8 Jun 2016 16:48:46 +0200
various fixes for smooth operation
also translatable string formatting
Diffstat:
4 files changed, 45 insertions(+), 17 deletions(-)
diff --git a/config b/config
@@ -38,6 +38,7 @@ mirror="http://packages.devuan.org/merged"
# mirror repo section
section="main"
+
# core packages for the system
core_packages=(devuan-keyring debian-keyring)
core_packages+=(git-core binutils ca-certificates curl)
@@ -50,5 +51,10 @@ base_packages=(bzip2 dialog apt-utils fakeroot e2fsprogs parted)
system_packages=(sysvinit ssh)
## libdevuansdk-specific settings
-workdir="$R/workdir"
+workdir="$H/workdir"
strapdir="${workdir}/strapdir"
+
+
+# declare zuper globals
+vars+=(os release version mirror section)
+vars+=(workdir strapdir)
diff --git a/libdevuansdk b/libdevuansdk
@@ -23,12 +23,16 @@
devuan_sdk_version=0.1
+setopt pushdsilent
+
+SDK_PREFIX=`pwd`
+SDK_HOME=`pwd`
+SDK_CONF=`pwd`
+
R=${SDK_PREFIX:-/usr/local/devuan-sdk}
H=${SDK_HOME:-$HOME/.devuan-sdk}
E=${SDK_CONF:-/etc/devuan-sdk}
-R=`pwd` # NOTE: for development
-
[[ -r $R ]] || {
print "Devuan SDK is not installed in: $R"
print "export SDK_PREFIX if installed on a different path"
@@ -50,7 +54,7 @@ LOG=${LOG:-""}
vars+=(R H E)
# source $R/zlibs/library
-source $R/config
+source $E/config
source $R/zlibs/debootstrap
source $R/zlibs/helpers
source $R/zlibs/sysconf
@@ -68,6 +72,9 @@ rehash
# For gettext
TEXTDOMAIN=devuan
+# create mandatory workdirs
+mkdir -p ${strapdir}
+
notice "Loading Devuan SDK library v$devuan_sdk_version"
# ...
diff --git a/zlibs/debootstrap b/zlibs/debootstrap
@@ -23,17 +23,21 @@
## Debootstrap things
+vars+=(bootstrap_tgz)
+
bootstrap() {
fn bootstrap $@
arch="$1"
req=(os strapdir workdir arch release mirror)
ckreq || return 1
- notice "Bootstrapping ${os} base"
+ notice "Bootstrapping ::1 OS:: base" ${os}
- mkdir -p ${strapdir}
+ bootstrap_tgz=$H/tmp/${os}-${arch}.tgz
- if [[ -f $R/tmp/${os}-${arch}.tgz ]]; then
+ if [[ -f $bootstrap_tgz ]]; then
+ notice "Using the existing bootstrap tarball found in ::1 tmpdir::" $H/tmp
+ ls -lh $bootstrap_tgz
tar_unpack ${strapdir}
else
# Debootstrap stage 1
@@ -123,23 +127,34 @@ EOF
tar_bootstrap() {
fn tar_bootstrap
+ req=(bootstrap_tgz)
+ ckreq || return 1
- if [[ -f $R/tmp/${os}-${arch}.tgz ]]; then
- return 0
+ local _dest=`dirname $bootstrap_tgz`
+
+ if [[ -f $bootstrap_tgz ]]; then
+ act "tarball found already in ::1 dir::" $_dest
else
+ notice "Creating boostrap tarball in ::1 tgz::" $bootstrap_tgz
pushd ${strapdir}
- tar czf ${os}-${arch}.tgz ./*
- mkdir -p $R/tmp
- mv ${os}-${arch}.tgz $R/tmp/
+ mkdir -p ${_dest}
+ escalate root "tar czf $bootstrap_tgz . --exclude=dev,sys,proc"
popd
fi
+ ls -lh $bootstrap_tgz
+
}
tar_unpack() {
fn tar_unpack $@
local unpath="$1"
- req=(unpath)
+ req=(unpath bootstrap_tgz)
ckreq || return 1
- tar xf $R/tmp/${os}-${arch}.tgz -C ${unpath}
+ [[ -r ${unpath}/bin/bash ]] && {
+ warning "bootstrap already unpacked in ::1 dir::" $unpath
+ return 1 }
+
+ mkdir -p ${unpath}
+ tar xf $bootstrap_tgz -C ${unpath}
}
diff --git a/zlibs/helpers b/zlibs/helpers
@@ -30,10 +30,10 @@ escalate() {
req=(user cmnd)
ckreq || return 1
- if [[ `command -v sudo` ]]; then
- sudo -E -u ${user} ${cmnd}
+ if isfound sudo; then
+ sudo -E -u ${user} ${=cmnd}
else
- su -c ${cmnd} ${user}
+ su -c "${=cmnd}" ${user}
fi
}