commit af6960725d34b4a9a1e37a9955555b69f41eda93
parent 55637ebfb49f0fd7c9c96d9f011e18723b442650
Author: parazyd <parazyd@dyne.org>
Date: Wed, 12 Oct 2016 13:58:47 +0200
remove redundant I/O
Diffstat:
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/zlibs/bootstrap b/zlibs/bootstrap
@@ -60,10 +60,6 @@ bootstrap_complete_base() {
conf_print_resolvconf | sudo tee $strapdir/etc/resolv.conf
conf_print_sourceslist | sudo tee $strapdir/etc/apt/sources.list
- ## below typically used in arm-sdk
- [[ -n $inittab ]] && { print $inittab | sudo tee -a $strapdir/etc/inittab }
- for i in $custmodules;do print $i | sudo tee -a $strapdir/etc/modules; done
-
## write third-stage for chroot
bootstrap_config_thirdstage | sudo tee $strapdir/thirdstage
bootstrap_config_cleanup | sudo tee $strapdir/cleanup
@@ -84,7 +80,8 @@ bootstrap_complete_base() {
sleep 1
devprocsys umount $strapdir || zerr
- bootstrap_tar_pack || zerr
+ bootstrap_tar_pack || zerr
+ bootstrap_tar_unpack $strapdir || zerr
}
bootstrap_config_cleanup() {
@@ -133,11 +130,12 @@ bootstrap_tar_pack() {
req=(bootstrap_tgz)
ckreq || return 1
- for i in $custmodules;do sudo sed -i -e 's/$i//' $strapdir/etc/modules;done
+ #for i in $custmodules;do sudo sed -i -e '/'$i'/d' $strapdir/etc/modules;done
+ #[[ -n $inittab ]] && sudo sed -i -e '/'$inittab'/d' $strapdir/etc/inittab
cat <<EOF | sudo tee ${strapdir}/prepack
#!/bin/sh
-apt-get --yes --force-yes purge ${extra_packages}
+#apt-get --yes --force-yes purge ${extra_packages}
apt-get --yes --force-yes autoremove
apt-get clean
EOF
@@ -169,18 +167,17 @@ bootstrap_tar_unpack() {
req=(unpath bootstrap_tgz)
ckreq || return 1
- [[ -f ${unpath}/.done ]] && {
- warn "bootstrap already unpacked in $unpath"
- return 1 }
-
- mkdir -p ${unpath}
- silly
- sudo tar xfp $bootstrap_tgz -C ${unpath}
- sudo mkdir -p ${unpath}/{boot,dev,sys,proc}
+ [[ -f ${unpath}/.done ]] || {
+ mkdir -p ${unpath}
+ silly
+ sudo tar xfp $bootstrap_tgz -C ${unpath}
+ sudo mkdir -p ${unpath}/{boot,dev,sys,proc}
+ }
cat <<EOF | sudo tee ${strapdir}/postunpack
#!/bin/sh
apt-get update
+apt-get --yes --force-yes upgrade
apt-get --yes --force-yes install ${extra_packages}
apt-get --yes --force-yes autoremove
apt-get clean
@@ -191,5 +188,7 @@ EOF
sudo -E chroot $strapdir /postunpack || zerr
dpkgdivert off $strapdir
+ ## below typically used in arm-sdk
+ [[ -z $inittab ]] || { print $inittab | sudo tee -a $strapdir/etc/inittab }
for i in $custmodules;do print $i | sudo tee -a $strapdir/etc/modules; done
}