From c54e5975a6a61e5ff27863b980521d4d2a86a25d Mon Sep 17 00:00:00 2001 From: lars Date: Mon, 8 Aug 2005 22:31:11 +0000 Subject: [PATCH] temporary directory /etc/hotplug "fixed" reboot and shutdown via "at" remove some packages for development systems set default runlevel to 3 export some environment settings (LANG and TERM) for "chroot" is_init_running migrated to "at" --- cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh | 4 ++-- cbox-tree.d/usr/lib/cryptobox/chroot-start.sh | 7 +++++++ cbox-tree.d/usr/lib/cryptobox/configure-cryptobox.sh | 10 +++++++++- cbox-tree.d/var/www/cgi-bin/cryptobox.pl | 4 ++-- etc-defaults.d/dfs.cbox.conf | 2 +- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh b/cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh index 5787088..2a6ff95 100755 --- a/cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh +++ b/cbox-tree.d/usr/lib/cryptobox/cbox-manage.sh @@ -180,9 +180,9 @@ function is_crypto_mounted() function is_init_running() { - ps -e | grep -q -E "$MKFS_DATA|$WIPE" + #ps -e | grep -q -E "$MKFS_DATA|$WIPE" # this line is good for the "at" stuff - see cryptobox.pl - [ -n "`at -l`" ] + [ -n "$(at -l)" ] } diff --git a/cbox-tree.d/usr/lib/cryptobox/chroot-start.sh b/cbox-tree.d/usr/lib/cryptobox/chroot-start.sh index afb123b..9cf4841 100755 --- a/cbox-tree.d/usr/lib/cryptobox/chroot-start.sh +++ b/cbox-tree.d/usr/lib/cryptobox/chroot-start.sh @@ -28,6 +28,13 @@ mount -n --bind "$TMP_DIR" "$MNT_DST" [ ! -e /proc/mounts ] && mount -n -t proc proc /proc +# default language setting - prevents dpkg error messages +export LANG=C + +# set default terminal (good if you are running in a screen session) +export TERM=linux + +# execute parameters as commandline if [ $# -gt 0 ] then "$@" else bash diff --git a/cbox-tree.d/usr/lib/cryptobox/configure-cryptobox.sh b/cbox-tree.d/usr/lib/cryptobox/configure-cryptobox.sh index 7685d0b..4777a17 100755 --- a/cbox-tree.d/usr/lib/cryptobox/configure-cryptobox.sh +++ b/cbox-tree.d/usr/lib/cryptobox/configure-cryptobox.sh @@ -14,12 +14,16 @@ set -eu RUNTIMEDIR=/opt/dfsruntime/runtimerd TUNDEV=$RUNTIMEDIR/dev/net/tun -SECURITY_REMOVE_PACKAGES="ssh strace telnet unzip tar zip wget ppp pppconfig nvi nano gzip curl bzip2 aptitude tasksel pppoe pppoeconf elinks" +SECURITY_REMOVE_PACKAGES="ssh strace unzip tar zip wget nvi nano gzip curl bzip2 aptitude tasksel elinks" +DEVEL_REMOVE_PACKAGES="exim4-daemon-light exim4-config exim4-base netkit-inetd telnet ppp pppconfig pppoe pppoeconf" function configure_normal() # the usual stuff - not optimized for security { + # set default runlevel to 3 + sed -i 's/^id:2:initdefault/id:3:initdefault/' /etc/inittab + ######### devices ########## # create tun device for running under qemu if [ ! -e "$TUNDEV" ] @@ -45,6 +49,10 @@ function configure_normal() # allow nput of password sed -i 's/^PasswordAuthentication.*$/PasswordAuthentication yes/' /etc/ssh/sshd_config fi + + # remove unnecessary packages - return true, if no packages were + # removed + dpkg --force-all -P $DEVEL_REMOVE_PACKAGES 2>&1 | grep -v "which isn't installed." || true } diff --git a/cbox-tree.d/var/www/cgi-bin/cryptobox.pl b/cbox-tree.d/var/www/cgi-bin/cryptobox.pl index d600fee..a372fb3 100755 --- a/cbox-tree.d/var/www/cgi-bin/cryptobox.pl +++ b/cbox-tree.d/var/www/cgi-bin/cryptobox.pl @@ -195,14 +195,14 @@ sub box_init sub system_poweroff() { &umount_vol(); - system("{sleep 5; /sbin/poweroff; } /dev/null &"); + system("echo /sbin/poweroff | at now + 1 minutes >>$LOG_FILE 2>&1"); } sub system_reboot() { &umount_vol(); - system("{sleep 5; /sbin/reboot; } /dev/null &"); + system("echo /sbin/reboot | at now + 1 minutes >>$LOG_FILE 2>&1"); } diff --git a/etc-defaults.d/dfs.cbox.conf b/etc-defaults.d/dfs.cbox.conf index 8b295c0..33fda07 100644 --- a/etc-defaults.d/dfs.cbox.conf +++ b/etc-defaults.d/dfs.cbox.conf @@ -144,7 +144,7 @@ ramdisk_files = /etc/resolv.conf /etc/network /var/lib/misc /var/lib/urandom - /etc/hotpug + /etc/hotplug /var/spool/cron # Directories to create on live fs