-
Notifications
You must be signed in to change notification settings - Fork 0
/
300-pacstrap.sh
executable file
·138 lines (127 loc) · 2.2 KB
/
300-pacstrap.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
#!/bin/bash
set -e # Exit on error
# Function to install packages
pacstrap_base() {
echo "Pacstrapping the base system"
packages=(
base
base-devel
linux
linux-firmware
intel-ucode
exfatprogs
ntfs-3g
btrfs-progs
reiserfsprogs
efibootmgr
grub
man-db
man-pages
texinfo
bash
bash-completion
zsh
zsh-completions
fish
python
python-pip
python-pipx
nodejs
npm
go
go-tools
rust
ruby
luajit
luarocks
neovim
lf
git
rsync
wget
plocate
pkgfile
reflector
fcron
dbus-broker
polkit
pacman-contrib
pacutils
arch-install-scripts
pigz
pbzip2
alsa-firmware
alsa-plugins
alsa-utils
wireplumber
pipewire-alsa
pipewire-jack
pipewire-pulse
rtkit
zram-generator
networkmanager
firewalld
grub-btrfs
inotify-tools
snapper
fastfetch
bat
eza
)
pacstrap /mnt/opensuse "${packages[@]}"
echo "Pacstrap complete."
}
# Function to modify grub files
modify_grub_d() {
# List of files to modify
grub_d_modify=("/mnt/opensuse/etc/grub.d/10_linux" "/mnt/opensuse/etc/grub.d/20_linux_xen")
# Loop through each file
for file in "${grub_d_modify[@]}"; do
if [[ -f "$file" ]]; then
echo "Modifying $file"
sed -i 's/rootflags=subvol=${rootsubvol}//g' "$file"
echo "Modification complete for $file."
else
echo "File $file does not exist."
fi
done
}
# Function to generate fstab
generate_fstab() {
echo "Generating fstab"
genfstab -U /mnt/opensuse >> /mnt/opensuse/etc/fstab
printf "\e[1;32mDone! \e[0m"
}
backup_fstab() {
# List of files to backup
fstab_backup=("/mnt/opensuse/etc/fstab")
for file in "${fstab_backup[@]}"; do
if [ ! -f "$file.bak" ]; then
cp "$file" "$file.bak" && printf "\e[1;33m%s backed up\e[0m\n" "$file"
else
printf "\e[1;33m%s already backed up\e[0m\n" "$file"
fi
done
}
# Function to modify fstab
modify_fstab() {
# List of files to modify
fstab_modify=("/mnt/opensuse/etc/fstab")
# Loop through each file
for file in "${fstab_modify[@]}"; do
if [[ -f "$file" ]]; then
echo "Modifying $file"
sed -i 's/subvolid=.*,//' "$file"
echo "Modification complete for $file."
else
echo "File $file does not exist."
fi
done
}
# Main script logic
pacstrap_base
modify_grub_d
generate_fstab
backup_fstab
modify_fstab
echo "Script completed."