Address shutdown slowdowns

* Unmount filesystem(s) and flush write cache before poweroff/reboot
* Also adjusted timouts to maybe fix issue #52
This commit is contained in:
2Shirt 2018-09-15 17:46:05 -06:00
parent da92cee338
commit 1e21c04a3e
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
3 changed files with 28 additions and 3 deletions

21
.bin/Scripts/wk-power-command Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
#
## Wizard Kit: Wrapper for logout, reboot, & poweroff
# Unmount filesystems
find /media -maxdepth 1 -mindepth 1 -type d \
-exec udevil umount "{}" \;
# Flush write cache
sudo sync
# Perform requested action
case "${1:-x}" in
poweroff)
sudo systemctl poweroff;;
reboot)
sudo systemctl reboot;;
*)
openbox --exit;;
esac
exit 0

View file

@ -15,6 +15,6 @@ restart = R
logout = L
[commands]
shutdown = systemctl poweroff
restart = systemctl reboot
logout = openbox --exit
shutdown = /usr/local/bin/wk-power-command poweroff
restart = /usr/local/bin/wk-power-command reboot
logout = /usr/local/bin/wk-power-command logout

View file

@ -219,6 +219,10 @@ function update_live_env() {
# Services
sed -i -r 's/^(.*pacman-init.*)$/#NOPE#\1/' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
sed -i -r 's/^(.*choose-mirror.*)$/#NOPE#\1/' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
# Shutdown stall fix
echo "sed -i -r 's/^.*(DefaultTimeoutStartSec)=.*$/\1=15s/' /etc/systemd/system.conf" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
echo "sed -i -r 's/^.*(DefaultTimeoutStopSec)=.*$/\1=15s/' /etc/systemd/system.conf" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
# SSH
mkdir -p "$SKEL_DIR/.ssh"