blob: 6ea2c9dc589b0a35abe71580672609b11e24f1b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#!/bin/sh
#
# 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${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) 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) 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) doas reboot ;; esac; ;;
l) logout ;;
b) break ;;
[h?]) echo "$USAGE";;
esac
clear
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
|