-
Notifications
You must be signed in to change notification settings - Fork 0
/
local.install
258 lines (222 loc) · 13.8 KB
/
local.install
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
#!/bin/zsh
set -ex
echo "\n:: Setting local timezone...\n"
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
hwclock --systohc
echo "\n:: Configuring localization...\n"
sed -i "s/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/" /etc/locale.gen
locale-gen
cat <<EOM > /etc/locale.conf
LANG=en_US.UTF-8
EOM
cat <<EOM > /etc/vconsole.conf
FONT=ter-132b
FONT_MAP=8859-2
EOM
echo "\n:: Configuring network...\n"
echo "$8" >> /etc/hostname
cat <<EOM > /etc/hosts
# Static table lookup for hostnames.
# See hosts(5) for details.
127.0.0.1 localhost
::1 localhost
$9 $8.localdomain $8
EOM
echo "\n:: Generating initramfs...\n"
sed -i "s/base udev/base udev resume/" /etc/mkinitcpio.conf
mkinitcpio -P
echo "\n:: Setting root password...\n"
echo root:$3 | chpasswd
echo "\n:: Creating system user and configuration...\n"
useradd -m -G wheel,lp,rfkill,log,adm,sys,systemd-journal,uucp -s /bin/zsh $4
echo $4:$5 | chpasswd
cat <<EOM > /home/$4/.vimrc
source \$VIMRUNTIME/defaults.vim
set clipboard=unnamedplus
set number
EOM
chown -R $4:$4 /home/$4/.vimrc
echo "Defaults passwd_timeout=0" | EDITOR="tee -a" visudo
echo "$4 ALL=(ALL) NOPASSWD: ALL" | EDITOR="tee -a" visudo # needed for makepkg to work in this script
echo "\n:: Setting up DM/DE...\n"
if [[ "$7" == "1" ]] then
echo "\n:: Installing Cinnamon and LightDM...\n"
pacman -Syu xorg lightdm cinnamon blueberry nemo nemo-share xed xreader system-config-printer --noconfirm
sed -i "s/#greeter-session=example-gtk-gnome/greeter-session=lightdm-slick-greeter/" /etc/lightdm/lightdm.conf
elif [[ "$7" == "2" ]] then
echo "\n:: Installing GNOME and GDM...\n"
pacman -Syu xorg gdm gnome-shell gnome-shell-extensions gnome-session gnome-menus gnome-settings-daemon gnome-control-center gnome-software gnome-tweaks gedit evince gnome-backgrounds mutter nautilus nautilus-share sushi gnome-shell-extension-appindicator gnome-disk-utility --noconfirm
fi
echo "\n:: Installing additional packages (official)...\n"
pacman -Syu alsa-utils nfs-utils cheese nano firefox chromium eog gthumb networkmanager gnome-screenshot gnome-keyring gnome-terminal gnome-logs gnome-calculator simple-scan vlc gimp vscode remmina freerdp libreoffice-still handbrake rhythmbox dconf-editor hplip python-pyqt5 cups ttf-dejavu imagemagick tlp i7z htop glances s-tui gvfs gvfs-goa gvfs-google gvfs-gphoto2 gvfs-mtp gvfs-nfs gvfs-smb bluez bluez-utils gnome-system-monitor --noconfirm
echo "\n:: Setting up boot loader..\n"
fs_uuid=$(blkid -o value -s UUID /dev/nvme0n1p2)
sed -i "s/loglevel=3 quiet/loglevel=3 quiet resume=UUID=$fs_uuid/" /etc/default/grub
sed -i "s/GRUB_CMDLINE_LINUX=\"\"/GRUB_CMDLINE_LINUX=\"\"\nGRUB_FONT=\"\/boot\/grubfont.pf2\"/" /etc/default/grub
sed -i "s/#GRUB_COLOR/GRUB_COLOR/" /etc/default/grub
sed -i "s/GRUB_TIMEOUT=5/GRUB_TIMEOUT=1/" /etc/default/grub
sed -i "s/GRUB_TIMEOUT_STYLE=menu/GRUB_TIMEOUT_STYLE=hidden/" /etc/default/grub
grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB
grub-mkfont -s 30 -o /boot/grubfont.pf2 /usr/share/fonts/TTF/DejaVuSansMono.ttf
grub-mkconfig -o /boot/grub/grub.cfg
echo "\n:: Installing additional packages (AUR)...\n"
su $4 -c "mkdir /home/$4/packages"
cd /home/$4/packages
su $4 -c "git clone https://aur.archlinux.org/zoom.git"
su $4 -c "git clone https://aur.archlinux.org/slack-desktop.git"
if [[ "$7" == "1" ]] then
su $4 -c "git clone https://aur.archlinux.org/lightdm-slick-greeter.git"
su $4 -c "git clone https://aur.archlinux.org/mint-artwork-cinnamon.git"
su $4 -c "git clone https://aur.archlinux.org/mint-themes.git"
su $4 -c "git clone https://aur.archlinux.org/mint-y-icons.git"
fi
find . -maxdepth 1 -mindepth 1 -type d -exec zsh -c "cd '{}' && su $4 -c \"makepkg -sri --noconfirm\"" \;
echo "\n:: Installing fingerprint reader libraries...\n"
cd /home/$4/packages
su $4 -c "git clone https://aur.archlinux.org/libfprint-tod-git.git"
cd /home/$4/packages/libfprint-tod-git
su $4 -c "makepkg -sri --noconfirm"
cd /home/$4/packages
su $4 -c "git clone https://aur.archlinux.org/libfprint-2-tod1-xps9300-bin.git"
cd /home/$4/packages/libfprint-2-tod1-xps9300-bin
su $4 -c "makepkg -sri --noconfirm"
cd /home/$4/packages
echo "\n:: Installing package dropbox...\n"
cd /home/$4/packages
su $4 -c "git clone https://aur.archlinux.org/dropbox.git"
cd /home/$4/packages/dropbox
su $4 -c "makepkg -sri --skippgpcheck --noconfirm"
cd /home/$4/packages
if [[ "$7" == "1" ]] then
su $4 -c "git clone https://aur.archlinux.org/nemo-dropbox.git"
cd /home/$4/packages/nemo-dropbox
su $4 -c "makepkg -sri --noconfirm"
cd /home/$4/packages
elif [[ "$7" == "2" ]] then
su $4 -c "git clone https://aur.archlinux.org/nautilus-dropbox.git"
cd /home/$4/packages/nautilus-dropbox
su $4 -c "makepkg -sri --noconfirm"
cd /home/$4/packages
fi
echo "\n:: Installing fingerprint reader (fprintd)...\n"
pacman -Syu fprintd --noconfirm
if [[ "$7" == "1" ]] then
sed -i "s/auth include system-auth/auth sufficient pam_unix.so try_first_pass likeauth nullok\nauth sufficient pam_fprintd.so\nauth include system-auth/" /etc/pam.d/cinnamon-screensaver
sed -i "s/auth include system-login/auth sufficient pam_unix.so try_first_pass likeauth nullok\nauth sufficient pam_fprintd.so\nauth include system-login/" /etc/pam.d/lightdm
fi
echo "\n:: Modify power / suspend settings..\n"
sed -i "s/load-module module-suspend-on-file/#load-module module-suspend-on-file/" /etc/pulse/default.pa
cat <<EOM > /etc/modprobe.d/audio_disable_powersave.conf
options snd_hda_intel power_save=0 power_save_controller=N
EOM
sed -i "s/#SOUND_POWER_SAVE_ON_AC=0/SOUND_POWER_SAVE_ON_AC=0/" /etc/tlp.conf
sed -i "s/#SOUND_POWER_SAVE_ON_BAT=1/SOUND_POWER_SAVE_ON_BAT=0/" /etc/tlp.conf
sed -i "s/#USB_AUTOSUSPEND=1/USB_AUTOSUSPEND=0/" /etc/tlp.conf
sed -i "s/#USB_BLACKLIST=\"1111:2222 3333:4444\"/USB_BLACKLIST=\"0bda:8153\"/" /etc/tlp.conf
echo "\n:: Enabling services...\n"
if [[ "$7" == "1" ]] then
systemctl enable lightdm.service
elif [[ "$7" == "2" ]] then
systemctl enable gdm.service
sudo -u gdm dbus-launch gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'
fi
systemctl enable NetworkManager.service
systemctl enable cups.service
systemctl enable bluetooth.service
systemctl enable tlp.service
systemctl enable systemd-timesyncd
echo "\n:: Enable touchscreen for Firefox...\n"
echo 'MOZ_USE_XINPUT2 DEFAULT=1' >> /etc/security/pam_env.conf
su $4 -c "mkdir -p /home/$4/.local/share/applications"
cp /arch-install-xps9300/.local/share/applications/* /home/$4/.local/share/applications/
chown -R $4:$4 /home/$4/
echo "\n:: Generating final script...\n"
cat <<EOM > /home/$4/final.install
#!/bin/zsh
echo "\n:: Setting volume...\n"
pacmd set-sink-mute 0 0
pacmd set-source-mute 1 0
pacmd set-sink-volume 0 50000
pacmd set-source-volume 1 25000
amixer sset Master 50%,50%
echo "\n:: Customizing desktop...\n"
if [[ "$7" == "1" ]] then
gsettings set org.cinnamon.theme name 'Mint-Y-Dark-Blue'
gsettings set org.cinnamon.desktop.interface gtk-theme 'Mint-Y-Dark-Blue'
gsettings set org.cinnamon.desktop.wm.preferences theme 'Mint-Y-Dark'
gsettings set org.cinnamon.desktop.interface icon-theme 'Mint-Y-Dark-Blue'
gsettings set org.cinnamon.settings-daemon.peripherals.touchpad clickpad-click 2
gsettings set org.cinnamon.settings-daemon.peripherals.touchpad tap-to-click false
gsettings set org.cinnamon.settings-daemon.peripherals.touchpad natural-scroll false
gsettings set org.cinnamon.settings-daemon.peripherals.touchpad custom-acceleration true
gsettings set org.cinnamon.settings-daemon.peripherals.touchpad motion-acceleration 9.3245436105476678
gsettings set org.cinnamon.settings-daemon.peripherals.touchpad horizontal-scrolling true
gsettings set org.cinnamon enabled-applets "['panel1:left:0:menu@cinnamon.org:0', 'panel1:left:1:show-desktop@cinnamon.org:1', 'panel1:left:2:grouped-window-list@cinnamon.org:2', 'panel1:right:8:systray@cinnamon.org:3', 'panel1:right:9:xapp-status@cinnamon.org:4', 'panel1:right:10:notifications@cinnamon.org:5', 'panel1:right:11:printers@cinnamon.org:6', 'panel1:right:12:removable-drives@cinnamon.org:7', 'panel1:right:14:network@cinnamon.org:9', 'panel1:right:15:sound@cinnamon.org:10', 'panel1:right:16:power@cinnamon.org:11', 'panel1:right:17:calendar@cinnamon.org:12', 'panel1:right:6:inhibit@cinnamon.org:14', 'panel1:right:3:workspace-switcher@cinnamon.org:17']"
gsettings set org.cinnamon.desktop.background picture-uri 'file:///home/$4/Pictures/full_moon_minimalism_3840x2400.jpg'
gsettings set org.cinnamon.desktop.interface clock-use-24h false
gsettings set org.nemo.desktop computer-icon-visible true
gsettings set org.nemo.desktop trash-icon-visible true
gsettings set org.nemo.desktop home-icon-visible true
gsettings set org.cinnamon.settings-daemon.plugins.power lock-on-suspend true
elif [[ "$7" == "2" ]] then
gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita-dark'
gsettings set org.gnome.desktop.interface clock-format '12h'
gsettings set org.gnome.desktop.interface clock-show-weekday true
gsettings set org.gnome.desktop.interface show-battery-percentage true
gsettings set org.gnome.desktop.peripherals.touchpad speed 0.38000000000000000
gsettings set org.gnome.desktop.peripherals.touchpad natural-scroll false
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'
gsettings set org.gnome.shell favorite-apps "['org.gnome.Nautilus.desktop', 'firefox.desktop', 'chromium.desktop', 'org.gnome.Terminal.desktop']"
gsettings set org.gnome.shell app-picker-layout "[{'org.gnome.Extensions.desktop': <{'position': <0>}>, 'gnome-control-center.desktop': <{'position': <1>}>, 'gnome-system-monitor.desktop': <{'position': <2>}>, 'htop.desktop': <{'position': <3>}>, 'Utilities': <{'position': <4>}>, 'Office': <{'position': <5>}>, 'ca.desrt.dconf-editor.desktop': <{'position': <6>}>, 'org.remmina.Remmina.desktop': <{'position': <7>}>, 'org.gnome.Calculator.desktop': <{'position': <8>}>, 'code-oss.desktop': <{'position': <9>}>, 'org.gnome.gedit.desktop': <{'position': <10>}>, 'gvim.desktop': <{'position': <11>}>, 'org.gnome.Cheese.desktop': <{'position': <12>}>, 'simple-scan.desktop': <{'position': <13>}>, 'org.gnome.gThumb.desktop': <{'position': <14>}>, 'gimp.desktop': <{'position': <15>}>, 'slack.desktop': <{'position': <16>}>, 'Zoom.desktop': <{'position': <17>}>, 'fr.handbrake.ghb.desktop': <{'position': <18>}>, 'rhythmbox.desktop': <{'position': <19>}>, 'vlc.desktop': <{'position': <20>}>, 'dropbox.desktop': <{'position': <21>}>, 'hplip.desktop': <{'position': <22>}>}, {'org.gnome.Software.desktop': <{'position': <0>}>, 'electron11.desktop': <{'position': <1>}>, 'qv4l2.desktop': <{'position': <2>}>, 'qvidcap.desktop': <{'position': <3>}>}]"
#gsettings set org.gnome.desktop.wm.preferences button-layout "'appmenu:minimize,maximize,close'"
gsettings set org.gnome.desktop.app-folders folder-children "['Utilities', 'YaST', 'Office']"
gsettings set org.gnome.desktop.app-folders.folder:/org/gnome/desktop/app-folders/folders/Office/ name 'Office'
gsettings set org.gnome.desktop.app-folders.folder:/org/gnome/desktop/app-folders/folders/Office/ translate true
gsettings set org.gnome.desktop.app-folders.folder:/org/gnome/desktop/app-folders/folders/Office/ categories "['Office']"
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true
#gnome-extensions enable launch-new-instance@gnome-shell-extensions.gcampax.github.com
#gnome-extensions enable user-theme@gnome-shell-extensions.gcampax.github.com
#gnome-extensions enable drive-menu@gnome-shell-extensions.gcampax.github.com
#gnome-extensions enable workspace-indicator@gnome-shell-extensions.gcampax.github.com
gnome-extensions enable appindicatorsupport@rgcjonas.gmail.com
gsettings set org.gnome.desktop.wm.keybindings show-desktop "['<Super>d']"
fi
currentprofile=\$(gsettings get org.gnome.Terminal.ProfilesList default)
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:\${currentprofile:1:-1}/ default-size-rows 28
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:\${currentprofile:1:-1}/ default-size-columns 120
#gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:\${currentprofile:1:-1}/ palette "['rgb(23,20,33)', 'rgb(192,28,40)', 'rgb(38,162,105)', 'rgb(162,115,76)', 'rgb(18,72,139)', 'rgb(163,71,186)', 'rgb(42,161,179)', 'rgb(208,207,204)', 'rgb(94,92,100)', 'rgb(246,97,81)', 'rgb(51,209,122)', 'rgb(233,173,12)', 'rgb(42,123,222)', 'rgb(192,97,203)', 'rgb(51,199,222)', 'rgb(255,255,255)']"
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:\${currentprofile:1:-1}/ bold-is-bright true
echo "\n:: Connecting to the internet...\n"
nmcli device wifi connect $1 password $2
if [[ "$6" != "na" ]] then
echo "\n:: Setting up printer...\n"
hp-setup -iax $6
fi
echo "\n:: Setting up fingerprint reader...\n"
fprintd-enroll
read "?Installation complete... "
rm /home/$4/.config/autostart/installer.desktop
rm /home/$4/final.install
EOM
chown -R $4:$4 /home/$4/final.install
chmod +x /home/$4/final.install
if [[ "$7" == "2" ]] then
echo "\n:: Setting mime types...\n"
su $4 -c "mkdir -p /home/$4/.config"
cp /arch-install-xps9300/mimeapps.list /home/$4/.config/mimeapps.list
chown -R $4:$4 /home/$4/.config/mimeapps.list
fi
echo "\n:: Generating final script autostart file...\n"
su $4 -c "mkdir -p /home/$4/.config/autostart"
cat <<EOM > /home/$4/.config/autostart/installer.desktop
[Desktop Entry]
Type=Application
Exec=gnome-terminal -e '/home/$4/final.install'
X-GNOME-Autostart-enabled=true
NoDisplay=false
Hidden=false
Name[en_US]=installer
Comment[en_US]=No description
X-GNOME-Autostart-Delay=2
EOM
chown -R $4:$4 /home/$4/.config/autostart/installer.desktop