change namespace

This commit is contained in:
parazyd 2016-06-08 17:29:32 +02:00
parent 9ea7593400
commit 3c3d59f4c2
No known key found for this signature in database
GPG Key ID: F0CB28FCF78637DE
2 changed files with 18 additions and 16 deletions

View File

@ -9,19 +9,19 @@ Main function, goes through stages 1, 2, and 3 of debootstrap.
Other internal functions are prefixed with `config_` and `tar_` Other internal functions are prefixed with `config_` and `tar_`
### config_cleanup() ### ### bootstrap_config_cleanup() ###
Final cleanup of the rootfs. Final cleanup of the rootfs.
### config_thirdstage() ### ### bootstrap_config_thirdstage() ###
Shell script for the system's third debootstrap stage. Shell script for the system's third debootstrap stage.
### tar_bootstrap() ### ### bootstrap_tar_pack() ###
Make a tarball of a base working system, ready to be worked on later. Make a tarball of a base working system, ready to be worked on later.
### tar_unpack() ### ### bootstrap_tar_unpack() ###
Unpack the tarball of a base working system to the strapdir. Unpack the tarball of a base working system to the strapdir.

View File

@ -38,7 +38,7 @@ bootstrap() {
if [[ -f $bootstrap_tgz ]]; then if [[ -f $bootstrap_tgz ]]; then
notice "Using the existing bootstrap tarball found in ::1 tmpdir::" $H/tmp notice "Using the existing bootstrap tarball found in ::1 tmpdir::" $H/tmp
ls -lh $bootstrap_tgz ls -lh $bootstrap_tgz
tar_unpack ${strapdir} bootstrap_tar_unpack ${strapdir}
else else
# Debootstrap stage 1 # Debootstrap stage 1
escalate "root" "debootstrap --foreign --arch ${arch} ${release} ${strapdir} ${mirror}" escalate "root" "debootstrap --foreign --arch ${arch} ${release} ${strapdir} ${mirror}"
@ -56,8 +56,8 @@ bootstrap() {
conf_print_sourceslist | escalate "root" "tee ${strapdir}/etc/apt/sources.list" conf_print_sourceslist | escalate "root" "tee ${strapdir}/etc/apt/sources.list"
# write third-stage for chroot # write third-stage for chroot
config_thirdstage | escalate "root" "tee ${strapdir}/thirdstage.sh" bootstrap_config_thirdstage | escalate "root" "tee ${strapdir}/thirdstage.sh"
config_cleanup | escalate "root" "tee ${strapdir}/cleanup.sh" bootstrap_config_cleanup | escalate "root" "tee ${strapdir}/cleanup.sh"
escalate "root" "chmod +x ${strapdir}/thirdstage.sh" escalate "root" "chmod +x ${strapdir}/thirdstage.sh"
escalate "root" "chmod +x ${strapdir}/cleanup.sh" escalate "root" "chmod +x ${strapdir}/cleanup.sh"
@ -73,11 +73,11 @@ bootstrap() {
umountdevproc ${strapdir} umountdevproc ${strapdir}
tar_bootstrap bootstrap_tar_pack
fi fi
} }
config_cleanup() { bootstrap_config_cleanup() {
fn config_cleanup fn config_cleanup
cat << EOF cat << EOF
@ -90,8 +90,8 @@ rm -f /etc/ssh/*.pub
EOF EOF
} }
config_thirdstage() { bootstrap_config_thirdstage() {
fn config_thirdstage fn bootstrap_config_thirdstage
req=(core_packages base_packages system_packages) req=(core_packages base_packages system_packages)
ckreq || return 1 ckreq || return 1
@ -128,8 +128,8 @@ dpkg-divert --remove --rename /usr/sbin/invoke-rc.d
EOF EOF
} }
tar_bootstrap() { bootstrap_tar_pack() {
fn tar_bootstrap fn bootstrap_tar_pack
req=(bootstrap_tgz) req=(bootstrap_tgz)
ckreq || return 1 ckreq || return 1
@ -147,15 +147,17 @@ tar_bootstrap() {
ls -lh $bootstrap_tgz ls -lh $bootstrap_tgz
} }
tar_unpack() { bootstrap_tar_unpack() {
fn tar_unpack $@ fn bootstrap_tar_unpack $@
local unpath="$1" local unpath="$1"
req=(unpath bootstrap_tgz) req=(unpath bootstrap_tgz)
ckreq || return 1 ckreq || return 1
# TODO: hack, drop a real file at one point to note it's the actual thing
[[ -r ${unpath}/bin/bash ]] && { [[ -r ${unpath}/bin/bash ]] && {
warning "bootstrap already unpacked in ::1 dir::" $unpath warning "bootstrap already unpacked in ::1 dir::" $unpath
return 1 } return 1
}
mkdir -p ${unpath} mkdir -p ${unpath}
tar xf $bootstrap_tgz -C ${unpath} tar xf $bootstrap_tgz -C ${unpath}