Browse Source

modify scripts to fallback to traditional commands if no systemd

pull/150/merge
Benjamin Slade 4 years ago
committed by Martin Kepplinger
parent
commit
bfb7842860
3 changed files with 12 additions and 4 deletions
  1. +8
    -0
      util/functions.sh
  2. +2
    -2
      x230/x230_heads.sh
  3. +2
    -2
      x230/x230_skulls.sh

+ 8
- 0
util/functions.sh View File

@ -57,3 +57,11 @@ warn_not_root() {
echo -e "${YELLOW}WARNING:${NC} This should not be executed as root!"
fi
}
poweroff() {
if command -v systemctl 2>/dev/null; then
systemctl poweroff
else
shutdown -P now
fi
}

+ 2
- 2
x230/x230_heads.sh View File

@ -155,8 +155,8 @@ rm -rf ${OUTPUT_PATH}
while true; do
read -r -p "Power off now? (please do!) Y/n: " yn
case $yn in
[Yy]* ) systemctl poweroff ;;
[Yy]* ) poweroff ;;
[Nn]* ) exit;;
* ) systemctl poweroff ;;
* ) poweroff ;;
esac
done

+ 2
- 2
x230/x230_skulls.sh View File

@ -217,8 +217,8 @@ rm -rf ${OUTPUT_PATH}
while true; do
read -r -p "Power off now? (please do!) Y/n: " yn
case $yn in
[Yy]* ) systemctl poweroff ;;
[Yy]* ) poweroff ;;
[Nn]* ) exit;;
* ) systemctl poweroff ;;
* ) poweroff ;;
esac
done

Loading…
Cancel
Save