aptautostart function
Add function for enabling or disabling autostart of services when apt installs them. To be called outside of a chroot and executed inside one
This commit is contained in:
parent
166e164ab0
commit
03f780a409
|
|
@ -74,6 +74,11 @@ mountdevproc /path/to/bootstrapped/chroot
|
||||||
## umountdevprocsys()
|
## umountdevprocsys()
|
||||||
Does the opposite of `mountdevprocsys`.
|
Does the opposite of `mountdevprocsys`.
|
||||||
|
|
||||||
|
## aptautostart()
|
||||||
|
enables/disables apt to autostart services after their packages are installed.
|
||||||
|
takes args `on` or `off` as 1st argument, and `/path/to/chroot` as second
|
||||||
|
argument
|
||||||
|
|
||||||
## silly()
|
## silly()
|
||||||
Because NSA
|
Because NSA
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,47 @@ umountdevprocsys() {
|
||||||
sudo umount ${mntdir}/sys && act "unmounted /sys" && sleep 2
|
sudo umount ${mntdir}/sys && act "unmounted /sys" && sleep 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aptautostart() {
|
||||||
|
fn aptautostart $@
|
||||||
|
local watdo="$1"
|
||||||
|
local wheredo="$2"
|
||||||
|
req=(watdo wheredo)
|
||||||
|
|
||||||
|
case $watdo in
|
||||||
|
on)
|
||||||
|
aptautostart printon | sudo tee ${wheredo}/aptautostart.sh
|
||||||
|
sudo chmod +x ${wheredo}/aptautostart.sh
|
||||||
|
sudo chroot ${wheredo} /aptautostart.sh
|
||||||
|
;;
|
||||||
|
off)
|
||||||
|
aptautostart printoff | sudo tee ${wheredo}/aptautostart.sh
|
||||||
|
sudo chmod +x ${wheredo}/aptautostart.sh
|
||||||
|
sudo chroot ${wheredo} /aptautostart.sh
|
||||||
|
;;
|
||||||
|
printon)
|
||||||
|
cat << EOF
|
||||||
|
#!/bin/sh
|
||||||
|
rm -f /usr/sbin/policy-rc.d
|
||||||
|
rm -f /usr/sbin/invoke-rc.d
|
||||||
|
dpkg-divert --remove --rename /usr/sbin/invoke-rc.d
|
||||||
|
rm -f /aptautostart.sh
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
printoff)
|
||||||
|
cat << EOF
|
||||||
|
#!/bin/sh
|
||||||
|
dpkg-divert --add --local --divert /usr/sbin/invoke-rc.d.chroot --rename /usr/sbin/invoke-rc.d
|
||||||
|
cp /bin/true /usr/sbin/invoke-rc.d
|
||||||
|
echo -e "#!/bin/sh\nexit 101" > /usr/sbin/policy-rc.d
|
||||||
|
chmod +x /usr/sbin/policy-rc.d
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error "Please pass a correct argument (on/off)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
silly() {
|
silly() {
|
||||||
fn silly $@
|
fn silly $@
|
||||||
local arg1="$1"
|
local arg1="$1"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue