blob: 3d28534a75500aaf306f1773e9861db6cca5a5f4 (
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
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
|
#!/bin/sh
default_packages="base linux xipkg dracut grub bash"
additional_packages="sudo neofetch vim networkmanager"
default_key="davidovski https://xi.davidovski.xyz/keychain/xi.pub"
XIPKG="/usr/bin/xi"
XIFLAGS="-yl"
TMPDIR=/tmp
SYSROOT=$1
[ ! -e $XIPKG ] && {
git clone https://xi.davidovski.xyz/git/xiutils.git $TMPDIR/xiutils
make && make install
git clone https://xi.davidovski.xyz/git/xipkg.git $TMPDIR/xipkg
make && make install
}
echo "Please make sure that you have correctly formatted any partitions and mounted them as desired under $SYSROOT"
[ $# -eq 0 ] && echo "Please specify where you would like to instal the system" && exit 1
[ -e $SYSROOT ] && {
printf "Remove existing system at $SYSROOT? [Y/n] "
read response
[ "$response" != "n" ] && rm -rf $SYSROOT && echo "removed $SYSROOT"
}
$XIPKG $XIFLAGS sync
$XIPKG $XIFLAGS -r $SYSROOT bootstrap $default_packages
$XIPKG $XIFLAGS -r $SYSROOT keyimport $default_key
configuring_users () {
echo "Setting root password: "
xichroot $SYSROOT passwd
echo
echo "Creating user"
read -p "Enter username: " username
xichroot $SYSROOT useradd -s /bin/bash -m $username
xichroot $SYSROOT passwd $username
}
configuring_system () {
read -p "Enter system hostname: " hostname
echo $hostname > $SYSROOT/etc/hostname
cat > $SYSROOT/etc/hosts << EOF
127.0.0.1 localhost
::1 localhost
127.0.1.1 $hostname.local $hostname
EOF
}
configuring_nameservers () {
echo "Configuring nameservers..."
cat > $SYSROOT/etc/resolv.conf << EOF
nameserver 80.80.80.80
EOF
}
generating_fstab () {
echo "Generating fstab..."
xichroot $SYSCONFIG genfstab -U / > $SYSROOT/etc/fstab
}
building_initramfs () {
echo "Building initramfs..."
kernel_version=$(ls $SYSROOT/usr/lib/modules | tail -1)
xichroot $SYSROOT mkdir /var/tmp
xichroot $SYSROOT dracut --kver $kernel_version 2>$TMPDIR/dracut.log > $TMPDIR/dracut.log
}
installing_bootloader () {
read -p "Install Grub? [y]" r
[ "$r" != "n" ] && {
opts="--target=x86_64-efi"
xichroot $SYSROOT lsblk
read -p "Enter efi directory: " efi_part
opts="$opts --efi-directory=$efi_part"
read -p "Removable system? [y]" r
[ "$r" != "n" ] && {
opts="$opts --removable"
}
xichroot $SYSROOT grub-install $opts
xichroot $SYSROOT grub-mkconfig -o /boot/grub/grub.cfg
}
}
downloading_additional_packages () {
echo "Syncing repos..."
xichroot $SYSROOT xi sync
echo "Downloading additional packages..."
xichroot $SYSROOT xi $XIFLAGS install $additional_packages
}
steps="
generating_fstab
building_initramfs
configuring_system
installing_bootloader
configuring_users
configuring_nameservers
downloading_additional_packages
"
len=$(echo "$steps" | wc -l)
i=0
echo "Press [return] to enter configuration"
read response
for step in $steps; do
i=$((i+1))
clear
hbar -t -T "$(echo $step | sed "s/_/ /g")" $i $len
$step
done
echo "Installation finished!"
|