cleanup created ssh keys upon finish

This commit is contained in:
parazyd 2016-06-08 17:07:07 +02:00
parent 3017288424
commit 9ea7593400
No known key found for this signature in database
GPG Key ID: F0CB28FCF78637DE
4 changed files with 17 additions and 17 deletions

2
config Executable file → Normal file
View File

@ -38,7 +38,6 @@ mirror="http://packages.devuan.org/merged"
# mirror repo section # mirror repo section
section="main" section="main"
# core packages for the system # core packages for the system
core_packages=(devuan-keyring debian-keyring) core_packages=(devuan-keyring debian-keyring)
core_packages+=(git-core binutils ca-certificates curl) core_packages+=(git-core binutils ca-certificates curl)
@ -54,7 +53,6 @@ system_packages=(sysvinit ssh)
workdir="$H/workdir" workdir="$H/workdir"
strapdir="${workdir}/strapdir" strapdir="${workdir}/strapdir"
# declare zuper globals # declare zuper globals
vars+=(os release version mirror section) vars+=(os release version mirror section)
vars+=(workdir strapdir) vars+=(workdir strapdir)

8
libdevuansdk Executable file → Normal file
View File

@ -34,8 +34,8 @@ H=${SDK_HOME:-$HOME/.devuan-sdk}
E=${SDK_CONF:-/etc/devuan-sdk} E=${SDK_CONF:-/etc/devuan-sdk}
[[ -r $R ]] || { [[ -r $R ]] || {
print "Devuan SDK is not installed in: $R" print "Devuan SDK is not installed in: $R"
print "export SDK_PREFIX if installed on a different path" print "export SDK_PREFIX if installed on a different path"
} }
@ -43,7 +43,7 @@ E=${SDK_CONF:-/etc/devuan-sdk}
## Load Zuper extensions ## Load Zuper extensions
# conclude initialization # conclude initialization
if [[ -r $R/zuper/zuper ]]; then if [[ -r $R/zuper/zuper ]]; then
source $R/zuper/zuper source $R/zuper/zuper
else source ./zuper/zuper; fi else source ./zuper/zuper; fi
DEBUG=${DEBUG:-0} DEBUG=${DEBUG:-0}
@ -61,7 +61,7 @@ source $R/zlibs/sysconf
# conclude initialization # conclude initialization
if [[ -r $R/zuper/zuper.init ]]; then if [[ -r $R/zuper/zuper.init ]]; then
source $R/zuper/zuper.init source $R/zuper/zuper.init
else source ./zuper/zuper.init; fi else source ./zuper/zuper.init; fi
# add all other binaries to the path # add all other binaries to the path

4
zlibs/debootstrap Executable file → Normal file
View File

@ -69,6 +69,7 @@ bootstrap() {
mountdevproc ${strapdir} mountdevproc ${strapdir}
escalate "root" "chroot ${strapdir} /thirdstage.sh" escalate "root" "chroot ${strapdir} /thirdstage.sh"
escalate "root" "chroot ${strapdir} /cleanup.sh"
umountdevproc ${strapdir} umountdevproc ${strapdir}
@ -84,6 +85,8 @@ config_cleanup() {
rm -f /debconf.set rm -f /debconf.set
rm -f /thirdstage.sh rm -f /thirdstage.sh
rm -f /etc/ssh/*key
rm -f /etc/ssh/*.pub
EOF EOF
} }
@ -142,7 +145,6 @@ tar_bootstrap() {
popd popd
fi fi
ls -lh $bootstrap_tgz ls -lh $bootstrap_tgz
} }
tar_unpack() { tar_unpack() {

20
zlibs/helpers Executable file → Normal file
View File

@ -39,22 +39,22 @@ escalate() {
mountdevproc() { mountdevproc() {
fn mountdevproc $@ fn mountdevproc $@
strapdir="$1" local mntdir="$1"
req=(strapdir) req=(mntdir)
ckreq || return 1 ckreq || return 1
escalate "root" "mount -t proc proc ${strapdir}/proc" && act "mounted /proc" escalate "root" "mount -t proc proc ${mntdir}/proc" && act "mounted /proc"
escalate "root" "mount -o bind /dev ${strapdir}/dev" && act "mounted /dev" escalate "root" "mount -o bind /dev ${mntdir}/dev" && act "mounted /dev"
escalate "root" "mount -o bind /dev/pts ${strapdir}/dev/pts" && act "mounted /dev/pts" escalate "root" "mount -o bind /dev/pts ${mntdir}/dev/pts" && act "mounted /dev/pts"
} }
umountdevproc() { umountdevproc() {
fn umountdevproc $@ fn umountdevproc $@
strapdir="$1" local mntdir="$1"
req=(strapdir) req=(mntdir)
ckreq || return 1 ckreq || return 1
escalate "root" "umount ${strapdir}/dev/pts" && act "unmounted /dev/pts" && sleep 2 escalate "root" "umount ${mntdir}/dev/pts" && act "unmounted /dev/pts" && sleep 2
escalate "root" "umount ${strapdir}/dev" && act "unmounted /dev" && sleep 2 escalate "root" "umount ${mntdir}/dev" && act "unmounted /dev" && sleep 2
escalate "root" "umount ${strapdir}/proc" && act "unmounted /proc" && sleep 2 escalate "root" "umount ${mntdir}/proc" && act "unmounted /proc" && sleep 2
} }