-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·141 lines (101 loc) · 4.09 KB
/
install.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
#!/usr/bin/env sh
# Base
# -----------------------------------------------------------------------------
# Discover directory where keystone is located.
export KEYSTONE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Source all libraries.
for x in $KEYSTONE_DIR/lib/*.sh; do . $x; done
# Source configuration file if existing.
[[ -f $KEYSTONE_DIR/config.sh ]] && . $KEYSTONE_DIR/config.sh
# Network
# -----------------------------------------------------------------------------
_print " * Awaiting network connection ..."
_wait_for_network
# Static configuration
# -----------------------------------------------------------------------------
export KEYSTONE_MOUNT=/mnt
export KEYSTONE_LC_COLLATE=C
export KEYSTONE_DEFAULT_NETWORK_MANAGER=wicd
# Dynamic Configuration
# -----------------------------------------------------------------------------
_print " * Building configuration ..."
_ask "Hostname" keystone KEYSTONE_HOSTNAME
_ask "Shell" bash KEYSTONE_SHELL
_ask "Console font" Lat2-Terminus16 KEYSTONE_CONSOLE_FONT
_ask "Console font map" 8859-1_to_uni KEYSTONE_FONT_MAP
_ask "Language" en_US.UTF-8 KEYSTONE_LANGUAGE
_ask "Timezone" US/Pacific KEYSTONE_TIMEZONE
_ask "Username" administrator KEYSTONE_USERNAME
_ask "AUR helper" aura KEYSTONE_AUR_HELPER
_ask "Bootloader" grub KEYSTONE_BOOTLOADER
_ask "Desktop Environment" none KEYSTONE_DESKTOP_ENVIRONMENT
_load "desktop-environment/$KEYSTONE_DESKTOP_ENVIRONMENT"
_ask "Window Manager" ${KEYSTONE_DEFAULT_WINDOW_MANAGER:-none} KEYSTONE_WINDOW_MANAGER
_load "window-manager/$KEYSTONE_WINDOW_MANAGER"
if [ $KEYSTONE_WINDOW_MANAGER != 'none' ]; then
_ask "Login Manager" ${KEYSTONE_DEFAULT_LOGIN_MANAGER:-none} KEYSTONE_LOGIN_MANAGER
_load "login-manager/$KEYSTONE_LOGIN_MANAGER"
fi
_ask "Network Manager" $KEYSTONE_DEFAULT_NETWORK_MANAGER KEYSTONE_NETWORK_MANAGER
# Load deferred blocks
# -----------------------------------------------------------------------------
_load "bootloader/$KEYSTONE_BOOTLOADER"
# Install base system (outside chroot)
# -----------------------------------------------------------------------------
if [[ -z $KEYSTONE_CHROOT ]]; then
_print " * Partition and mount drive configuration at /mnt ..."
read -p "Press any key when done... " -n1 -s
_print ""
_print " * Installing base system ..."
_load 'core/base'
_print " * Generate filesystem information ..."
_load 'core/fstab'
_print " * Activating new environment ..."
_load 'core/chroot'
fi
# Configure system (inside chroot)
# -----------------------------------------------------------------------------
if [[ $KEYSTONE_CHROOT ]]; then
_print " * Configuring hostname ..."
_load 'core/hostname'
_print " * Configuring locale ..."
_load 'core/locale'
_print " * Configuring time and date ..."
_load 'time/common'
_load 'time/network'
_print " * Awaiting network connection ..."
_wait_for_network
_print " * Optimizing pacman ..."
_load 'pacman/powerpill'
_print " * Configuring virtual console font ..."
_load 'core/vconsole'
_print " * Generating initial ramdisk ..."
_load 'core/mkinitcpio'
_print " * Setting root password ..."
passwd
_print " * Adding normal user ..."
_load 'core/user'
if [[ -n $KEYSTONE_XORG ]]; then
_print " * Configuring display drivers ..."
_load 'xorg/xorg-server'
_print " * Installing desktop environment ..."
_desktop_environment__chroot
_window_manager__chroot
_login_manager__chroot
fi
_print " * Installing network management utilities ..."
_load 'network/common'
_load "network/$KEYSTONE_NETWORK_MANAGER"
_print " * Installing bootloader in new environment ..."
_bootloader__chroot
fi
# Post-configure Install (outside chroot)
# -----------------------------------------------------------------------------
if [[ -z $KEYSTONE_CHROOT ]]; then
_print " * Installing bootloader on device..."
_bootloader__post_chroot
_print " * Cleaning up..."
rm -rf "$KEYSTONE_MOUNT/root/$(basename $(realpath $(dirname $0)))"
_countdown 10 "Rebooting"
reboot
fi