aboutsummaryrefslogtreecommitdiff
path: root/kvmx-create
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-06-13 21:28:46 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-06-13 21:28:46 -0300
commitac2562e2296fb2c94c509672cb28fc5180207808 (patch)
tree1472a3c93fcc292e432043d45b14431567ed0288 /kvmx-create
parent7991f82317685dca908f7a5e6c0a6482bf0b493f (diff)
downloadkvmx-ac2562e2296fb2c94c509672cb28fc5180207808.tar.gz
kvmx-ac2562e2296fb2c94c509672cb28fc5180207808.tar.bz2
Better trap at kvmx-create (2) and rollback from global env config for LC_ALL and DEBIAN_FRONTEND
Diffstat (limited to 'kvmx-create')
-rwxr-xr-xkvmx-create12
1 files changed, 4 insertions, 8 deletions
diff --git a/kvmx-create b/kvmx-create
index eafd489..b7cb993 100755
--- a/kvmx-create
+++ b/kvmx-create
@@ -23,10 +23,6 @@ BASENAME="`basename $0`"
DIRNAME="`dirname $0`"
GLOBAL_USER_CONFIG_FILE="$HOME/.config/kvmxconfig"
-# Environment config
-export LC_ALL=C
-export DEBIAN_FRONTEND=noninteractive
-
# Load basic functions
export APP_BASE="`$DIRNAME/kvmx app_base`"
source $APP_BASE/lib/kvmx/functions || exit 1
@@ -79,7 +75,7 @@ function kvmx_install_package {
if [ "$?" == "1" ]; then
echo "Installing package $1..."
- $SUDO apt-get install $1 -y || exit 1
+ DEBIAN_FRONTEND=noninteractive $SUDO apt-get install $1 -y || exit 1
fi
}
@@ -260,14 +256,14 @@ function kvmx_create_custom {
kvmx_sudo_run mount ${device}${partition_prefix}2 $WORK/
# Trap $WORK umount
- trap 'if [ -e "$WORK" ]; then umount $WORK && rmdir $WORK; fi' INT TERM
+ trap 'if [ -e "$WORK" ]; then umount $WORK/{sys,proc,dev} &> /dev/null; umount $WORK &> /dev/null; rmdir $WORK; fi' INT TERM
# Non-interactive installation
- APT_INSTALL="kvmx_sudo_run chroot $WORK/ apt-get install -y"
+ APT_INSTALL="LC_ALL=C DEBIAN_FRONTEND=noninteractive kvmx_sudo_run chroot $WORK/ apt-get install -y"
# Initial system install.
echo "Installing base system..."
- kvmx_sudo_run debootstrap \
+ LC_ALL=C DEBIAN_FRONTEND=noninteractive kvmx_sudo_run debootstrap \
--force-check-gpg --arch=$arch $version $WORK/ $mirror
# Initial configuration.