blob: b41780ae010db30234f8e9afe2288607e376ea7e (
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
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
|
#!/bin/sh
# DIALOG()
# an el-cheapo dialog wrapper
#
# parameters: see dialog(1)
# returns: whatever dialog did
DIALOG() {
dialog --backtitle "$TITLE" --aspect 15 "$@"
return $?
}
printk()
{
case $1 in
"on") echo 4 >/proc/sys/kernel/printk ;;
"off") echo 0 >/proc/sys/kernel/printk ;;
esac
}
getdest() {
[ "$DESTDIR" ] && return 0
DIALOG --inputbox "Enter the destination directory where your target system is mounted" 8 65 "/tmp/install" 2>$ANSWER || return 1
DESTDIR=$(cat $ANSWER)
}
geteditor() {
if ! [ $(which vi) ]; then
DIALOG --menu "Select a Text Editor to Use" 10 35 3 \
"1" "nano (easier)" 2>$ANSWER
else
DIALOG --menu "Select a Text Editor to Use" 10 35 3 \
"1" "nano (easier)" \
"2" "vi" 2>$ANSWER
fi
case $(cat $ANSWER) in
"1") EDITOR="nano" ;;
"2") EDITOR="vi" ;;
*) EDITOR="nano" ;;
esac
}
mainmenu() {
if [ -n "$NEXTITEM" ]; then
DEFAULT="--default-item $NEXTITEM"
else
DEFAULT=""
fi
dialog $DEFAULT --backtitle "$TITLE" --title " MAIN MENU " \
--menu "Use the UP and DOWN arrows to navigate menus. Use TAB to switch between buttons and ENTER to select." 17 55 13 \
"0" "Keyboard And Console Setting" \
"1" "Set Clock" \
"2" "Prepare Hard Drive" \
"3" "Select Source" \
"4" "Select Packages" \
"5" "Install Packages" \
"6" "Configure System" \
"7" "Install Bootloader" \
"8" "Exit Install" 2>$ANSWER
NEXTITEM="$(cat $ANSWER)"
case $(cat $ANSWER) in
"0")
set_keyboard ;;
"1")
set_clock ;;
"2")
prepare_harddrive ;;
"3")
select_source ;;
"4")
selectpkg ;;
"5")
installpkg ;;
"6")
configure_system ;;
"7")
install_bootloader ;;
"8")
if [ "$S_SRC" = "1" -a "$MODE" = "cd" ]; then
umount /src >/dev/null 2>&1
fi
[ -e /tmp/.setup-running ] && rm /tmp/.setup-running
clear
echo ""
echo "If the install finished successfully, you can now type 'reboot'"
echo "to restart the system."
echo ""
exit 0 ;;
*)
DIALOG --yesno "Abort Installation?" 6 40 &&[ -e /tmp/.setup-running ] && rm /tmp/.setup-running && clear && exit 0
;;
esac
}
|