-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharchPostInstall.sh
More file actions
executable file
·202 lines (171 loc) · 4.73 KB
/
archPostInstall.sh
File metadata and controls
executable file
·202 lines (171 loc) · 4.73 KB
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
#!/bin/bash
function getAbsFilename() {
# $1 : relative filename
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
}
function installAurHelper() {
clear
if ! command -v $1 &> /dev/null
then
echo "Installing $1..."
sudo pacman -S --noconfirm --needed git
sleep 2
[ ! -d "$HOME/Downloads" ] && mkdir ~/Downloads
cd ~/Downloads
if [ "$1" == "paru" ]
then
sudo pacman -S --noconfirm --needed rust
fi
git clone "https://aur.archlinux.org/$1.git"
cd $1
sudo -u $(logname) makepkg --noconfirm -si
else
echo "$1 has already been installed!"
sleep 2
fi
}
function installNativePackages() {
clear
echo "Installing native packages in packages-list-native.txt..."
sleep 2
cd $1
sudo pacman -S --noconfirm --needed - < packages-list-native.txt
}
function installForeignPackages() {
clear
echo "Installing foreign packages in packages-list-foreign.txt..."
sleep 2
cd $1
$2 -S --noconfirm --needed - < packages-list-foreign.txt
}
function simlinkDotfiles() {
clear
echo "Creating directories and simlinking dotfile..."
sleep 2
[ ! -d "$HOME/.config" ] && mkdir $HOME/.config
mkdir -p $HOME/.local/{bin,share/{audio,fonts}}
cd $1
sudo pacman -S --noconfirm --needed stow
make
}
function installXmonad () {
clear
echo "Installing xmonad as the window manager..."
sleep 2
if [ $3 -eq 1 ]
then
cd ~/.config/xmonad
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
else
mkdir -p ~/.local/bin
PATH="$HOME/.local/bin:$PATH"
fi
sudo pacman -S --noconfirm --needed stack
stack upgrade
[ -f "stack.yaml" ] && rm stack.yaml
stack init
stack install
sudo ln -s $HOME/.local/bin/{xmonad,xmonad-dbus} /usr/bin
else
sudo pacman -S --noconfirm --needed xmonad xmonad-contrib
$2 -S --noconfirm --needed xmonad-dbus-git
fi
xmonad --recompile
echo "Setting up sddm as the login manager..."
[ ! -d "/usr/share/xsessions" ] && sudo mkdir -p /usr/share/xsessions
sudo cp $1/desktop/xmonad.desktop /usr/share/xsessions
sudo pacman -S --noconfirm --needed sddm
sudo systemctl enable sddm
$2 -S --noconfirm --needed sddm-theme-astronaut
sudo sh -c 'echo "[Theme]" >> /etc/sddm.conf'
sudo sh -c 'echo "Current=astronaut" >> /etc/sddm.conf'
}
function setupZsh() {
clear
echo "Setting up Zsh..."
sleep 2
sudo pacman -S --noconfirm --needed zsh zsh-completions
sudo pacman -S --noconfirm --needed curl wget
if [ ! -d "$HOME/.oh-my-zsh" ]
then
mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc
fi
sudo chsh -s $(which zsh) $(logname)
[ ! -d "$HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting" ] && git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
[ ! -d "$HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions" ] && git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
}
function installDoomEmacs() {
clear
echo "Installing doom emacs..."
sleep 2
sudo pacman -S --noconfirm --needed git emacs ripgrep fd
git clone --depth 1 https://github.com/doomemacs/doomemacs ~/.emacs.d
~/.emacs.d/bin/doom --force install
~/.emacs.d/bin/doom sync
}
function main() {
clear
echo "Welcome!" && sleep 1
cfg=`dirname $(getAbsFilename "$0")`
helper="paru"
xmonadOpt="y"
zshOpt="y"
doomOpt="y"
echo "Would you like to install xmonad"
read -r -p ":: [Y/n] " opt
if [[ ( ! -z "$opt" ) && ( "$opt" == "n" || "$opt" == "N" ) ]]
then
xmonadOpt="n"
fi
echo "Would you like to change default shell to zsh"
read -r -p ":: [Y/n] " opt
if [[ ( ! -z "$opt" ) && ( "$opt" == "n" || "$opt" == "N" ) ]]
then
zshOpt="n"
fi
echo "Would you like to install doom emacs"
read -r -p ":: [Y/n] " opt
if [[ ( ! -z "$opt" ) && ( "$opt" == "n" || "$opt" == "N" ) ]]
then
doomOpt="n"
fi
echo "Which AUR helper would you like to install?"
echo "1) paru 2)yay"
read -r -p "Default is paru(1): " opt
if [ ! -z "$opt" ] && [ $opt -eq 2 ]
then
helper="yay"
fi
cd $cfg
clear
echo "Doing a system update..."
#sudo sh -c 'echo -e "\nDefaults timestamp_timeout=-1" >> /etc/sudoers'
sudo pacman --noconfirm -Syu
git submodule update --remote --merge
installNativePackages $cfg
installAurHelper $helper
installForeignPackages $cfg $helper
simlinkDotfiles $cfg
if [ "$xmonadOpt" == "y" ]
then
installXmonad $cfg $helper 1
fi
if [ "$zshOpt" == "y" ]
then
setupZsh
fi
if [ "$doomOpt" == "y" ]
then
# FIXME: this doesn't work for some reason
installDoomEmacs
fi
clear
#sudo sed '$d' -i /etc/sudoers
echo "Installation process done!"
echo "Restart to enjoy your new setup ;-)"
sleep 2
}
main