This repository has been archived by the owner on Apr 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 157
/
menus.sh
156 lines (146 loc) · 5.07 KB
/
menus.sh
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/usr/bin/env bash
###############################################################
### Anarchy Linux Install Script
### menus.sh
###
### Copyright (C) 2017 Dylan Schacht
###
### By: Dylan Schacht (deadhead)
### Email: [email protected]
### Webpage: https://anarchylinux.org
###
### Any questions, comments, or bug reports may be sent to above
### email address. Enjoy, and keep on using Arch.
###
### License: GPL v2.0
###############################################################
reboot_system() {
op_title="$complete_op_msg"
## Check if system is installed
if "$INSTALLED" ; then
## Check if user has installed bootloader, if no promtp to exit to commandline
if [ "$bootloader" == "$none" ]; then
if (dialog --yes-button "$yes" --no-button "$no" --yesno "\n$complete_no_boot_msg" 10 60) then
reset ; exit
fi
fi
## Begin reboot menu loop
while (true)
do
## Prompt for user input
reboot_menu=$(dialog --nocancel --ok-button "$ok" --menu "$complete_msg" 16 60 7 \
"$reboot0" "-" \
"$reboot6" "-" \
"$reboot2" "-" \
"$reboot1" "-" \
"$reboot4" "-" \
"$reboot3" "-" \
"$reboot5" "-" 3>&1 1>&2 2>&3)
## Execute user input
case "$reboot_menu" in
"$reboot0") ## Reboot system
umount -R "$ARCH"
reset ; reboot ; exit
;;
"$reboot6") ## Poweroff system
umount -R "$ARCH"
reset ; poweroff ; exit
;;
"$reboot1") ## Unmount system and exit to command line
umount -R "$ARCH"
reset ; exit
;;
"$reboot2") ## Anarchy Chroot function
clear
echo -e "$arch_chroot_msg"
echo "/root" > /tmp/chroot_dir.var
anarchy_chroot
clear
;;
"$reboot3") ## Edit users
menu_enter=true
set_user
;;
"$reboot5") ## Software menu
menu_enter=true
add_software
;;
"$reboot4") ## Show install log
clear ; less "$log" clear
;;
esac
done
else
## Warn user install not complete, prompt for reboot
if (dialog --yes-button "$yes" --no-button "$no" --yesno "$not_complete_msg" 10 60) then
umount -R "$ARCH"
reset ; reboot ; exit
fi
fi
}
main_menu() {
op_title="$menu_op_msg"
while (true)
do
menu_item=$(dialog --nocancel --ok-button "$ok" --menu "$menu" 19 60 8 \
"$menu13" "-" \
"$menu0" "-" \
"$menu1" "-" \
"$menu2" "-" \
"$menu3" "-" \
"$menu5" "-" \
"$menu11" "-" \
"$menu12" "-" 3>&1 1>&2 2>&3)
case "$menu_item" in
"$menu0") ## Set system locale
set_locale
;;
"$menu1") ## Set system timezone
set_zone
;;
"$menu2") ## Set system keymap
set_keys
;;
"$menu3") ## Prepare drives check if mounted
if "$mounted" ; then
if (dialog --yes-button "$yes" --no-button "$no" --defaultno --yesno "\n$menu_err_msg3" 10 60); then
mounted=false ; prepare_drives
fi
else
prepare_drives
fi
;;
"$menu5") ## Begin base install
if "$mounted" ; then
install_options
set_hostname
set_user
add_software
install_base
configure_system
add_user
reboot_system
elif (dialog --yes-button "$yes" --no-button "$no" --yesno "\n$install_err_msg1" 10 60) then
prepare_drives
fi
;;
"$menu11") ## Reboot system function
reboot_system
;;
"$menu12") ## Exit installer
if (dialog --yes-button "$yes" --no-button "$no" --yesno "\n$menu_exit_msg" 10 60) then
reset ; exit
fi
;;
"$menu13") ## Start command line session
echo -e "alias anarchy=exit ; echo -e '$return_msg'" > /tmp/.zshrc
clear
ZDOTDIR=/tmp/ zsh
rm /tmp/.zshrc
clear
;;
esac
## End main menu loop
done
}
# vim: ai:ts=4:sw=4:et