diff options
author | Bryson Steck <brysonsteck@protonmail.com> | 2022-10-26 12:05:56 -0600 |
---|---|---|
committer | Bryson Steck <brysonsteck@protonmail.com> | 2022-10-26 12:05:56 -0600 |
commit | c58abab9e5f14fdabb1ea8b314c370fb515b7b69 (patch) | |
tree | 373f7ecbeebb90ae9664138ffe0dfb1272584b9d /bash/.bash/03-boot.bash | |
parent | 8a7a01214c68b6a4c2f6531d0d1dea6415fe9c89 (diff) | |
download | dotfiles-c58abab9e5f14fdabb1ea8b314c370fb515b7b69.tar dotfiles-c58abab9e5f14fdabb1ea8b314c370fb515b7b69.tar.gz dotfiles-c58abab9e5f14fdabb1ea8b314c370fb515b7b69.tar.bz2 |
havent updated these in a while
Diffstat (limited to 'bash/.bash/03-boot.bash')
-rw-r--r-- | bash/.bash/03-boot.bash | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/bash/.bash/03-boot.bash b/bash/.bash/03-boot.bash index fd68025..6ea2c9d 100644 --- a/bash/.bash/03-boot.bash +++ b/bash/.bash/03-boot.bash @@ -2,31 +2,49 @@ # # 03-boot.bash # startup scripts for systems -# + +bat_check() { + TEST=$(acpi | grep "Dis") + + if [[ $? -eq 0 ]]; then + echo "***********************************************************" + echo " WARNING" + echo "***********************************************************" + echo "Power supply is not plugged in." + echo "Make sure it is plugged in to avoid a random shutdown." + read -rs -N 1 -p "Press [Enter] to continue, any other key to return..." input; + if grep -q "$input" <<< ""; then + echo "" + else + return 1 + fi + fi +} # run startup script if tty # for dingo if [[ $TERM == 'linux' && $(hostname) == 'dingo' ]]; then cat ~/bin/house.txt printf "\n${CYAN}Welcome back Bryson :)\n\n" - printf "${LGREEN}What should dingo do?\n${blue}" + printf "${LGREEN}What should dingo do?\n${magenta}" echo -e '\td: start docked\n\tn: start not docked\n\tq: shutdown\n\tr: reboot\n\tl: logout\n\tb: bash\n\n' while read -rs -N 1 key; do printf "${NC}" case $key in - d) startx ;; + d) bat_check && startx ;; n) nstartx.sh ;; q) echo "Are you sure you want to shutdown? (y/n)"; - read -rs -N 1 key2; case $key2 in y) shutdown now ;; esac; ;; + read -rs -N 1 key2; case $key2 in y) doas shutdown -Ph now ;; esac; ;; r) echo "Are you sure you want to reboot? (y/n)"; - read -rs -N 1 key3; case $key3 in y) reboot ;; esac; ;; + read -rs -N 1 key3; case $key3 in y) doas reboot ;; esac; ;; l) logout ;; b) break ;; [h?]) echo "$USAGE";; esac clear - printf "\n${red}Please try again...${NC}\n\n${LGREEN}What should dingo do now?\n${blue}" + cat ~/bin/house.txt + printf "\n${LGREEN}What should dingo do now?\n${magenta}" echo -e '\td: start docked\n\tn: start not docked\n\tq: shutdown\n\tr: reboot\n\tl: logout\n\tb: bash\n\n' done fi |