This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathubuntu_restore.sh
executable file
·216 lines (178 loc) · 5.97 KB
/
ubuntu_restore.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
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
#!/usr/bin/bash
# A BASH script based on my Fedora script
# Similar to Fedora script, but designed for DEB based distros
# TODO
# Change packages names as needed from initial install
## Enter username to configure
### Assign output from bash command to variable
username=$(whoami)
echo "Some configurations are user specific"
echo "Configuring for user $username"
echo "Ensure this user has sudo access"
### Check for username, confirm if user to use
echo "Do you want to configure for this user? y/n"
read confirm
if [ "$confirm" == "y" || "$confirm" == "Y" ]; then
echo "Continue"
else
echo "Exiting"
echo "Re-run as user to configure"
exit
fi
## Update system and reinstall software
echo "Preparing to install Chrome, MotionPro, Nagstamon, Autokey and more"
echo "Do you want to install software? y/n"
read confirm
if [ "$confirm" == "y" || "$confirm" == "Y" ]; then
echo "Installing software"
### Update system
echo "Updating system"
sudo apt update -y && sudo apt upgrade -y
### Install repo software
#### TODO, add correct file names
echo "Installing essential software"
sudo apt install nagstamon liberation-fonts python3 qt5 zsh git autokey-gtk redshift cmake build-essential make python-dev speedtest-cli neofetch gimp -y
### Install rpm software
#### Download and Install Google Chrome
cd /home/$username/Downloads
echo "Downloading and installing Google Chrome"
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
echo "Nagstamon installed earlier"
echo "Nagstamon will still need configured"
sleep 5
### Enable SNAP classic
echo "Installing snap store"
sudo apt install snapd -y
sudo ln -s /var/lib/snapd/snap /snap/
### Install SNAP store software
echo "Google Cloud SDK"
sudo snap install google-cloud-sdk --classic
### Install non-repo and non-RPM software
#### Install MotionPro
echo "Downloading and installing MotionPro"
cd /home/$username/Downloads
#### UPDATE URL AND FILENAME ####
wget https://www.hipaavault.com/ArrayNetworks/MotionPro_Linux_Ubuntu_x64_v1.2.7_0608.sh
chmod +x MotionPro_Linux_Ubuntu_x64_v1.2.7_0608.sh
sudo bash MotionPro_Linux_Ubuntu_x64_v1.2.7_0608.sh
echo "MotionPro will still need configured"
echo "Autokey will still need to be configured"
echo "redshift will still need to be configured"
#### If user doesn't want to install software
else
echo "Skipping"
echo "This is not recommended..."
fi
## Clone config repo
echo "Preparing to clone notes, vim configurations and zsh configurations"
echo "Do you want the configurations? y/n"
read confirm
if [ "$confirm" == "y" || "$confirm" == "Y" ]; then
echo "Cloning config repo"
cd /home/$username/Documents/
mkdir gits
cd gits
git clone https://gitlab.com/ngrogg/configs.git
### Copy vimrc and zshrc
echo "Copying vimrc and zshrc config files"
cd configs
cp Desktop\ Configs/vimrc /home/$username/.vimrc
cp Desktop\ Configs/zshrc /home/$username/.zshrc
else
echo "Initial configuration complete, reboot system to finish configuration"
sleep 5
exit
fi
### Configure zsh
echo "Preparing to configure zsh"
echo "Do you want ZSH installed? y/n"
read confirm
#### Copy config files and edit passwd
if [ "$confirm" == "y" || "$confirm" == "Y" ]; then
zshYes="yes"
echo "Configuring zsh"
echo "Use tab for fuzzy autocomplete"
sleep 5
cd /home/$username
mkdir /home/$username/.zsh/
mkdir /home/$username/.zsh/cache
touch /home/$username/.zsh/cache/history
sed -i "s/\/home\/$username\:\/usr\/bin\/bash/\/home\/$username\:\/usr\/bin\/zsh/g" /etc/passwd
#### Add aliases to zshrc
echo "Adding aliases to zshrc"
if [ "$username" == "ngrogg" ]; then
echo "alias wikitogit='bash ~/.scripts/wikitogit.sh'" >> /home/$username/.zshrc
echo "alias wikifromgit='bash ~/.scripts/wikifromgit.sh'" >> /home/$username/.zshrc
else
echo "alias wikifromgit='bash ~/.scripts/wikifromgit.sh'" >> /home/$username/.zshrc
fi
#### If user doesn't want ZSH
else
echo "Skipping ZSH configuration"
zshYes="no"
fi
### Open vim to trigger installation of plugins
echo "Preparing to configure vim"
echo "Do you want vim configured? y/n"
read confirm
if [ "$confirm" == "y" || "$confirm" == "Y" ]; then
echo "Configuring Vim"
cd /home/$username
echo "This should install the plugins for vim"
echo "Quit vim after installation finishes"
sleep 5
vim .vimrc
### Install YouCompleteMe
#### Review that section
echo "Installing YouCompleteMe"
cd .vim/plugged/YouCompleteMe/
python3 install.py --clangd-completer
else
echo "Skipping vim configurations"
fi
## Configure vim wiki
echo "Preparing to clone note repo"
echo "Do you want the vimwiki note repo? y/n"
read confirm
if [ "$confirm" == "y" || "$confirm" == "Y" ]; then
### Clone vimwiki notes repo
#### Permissions
echo "Cloning notes from git repo"
cd /home/$username/Documents/gits
git clone https://github.com/ngrogg360/notes.git
#### Create vimwiki directory
cd /home/$username
mkdir vimwiki
#### Copy vimwiki
echo "Copying vimwiki"
echo "Access vimwiki by opening vi and pressing \ w w"
sleep 5
cp /home/$username/Documents/gits/notes/*.wiki ~/vimwiki
#### Copy wikito/wikifrom scripts
echo "Copying scripts from configs"
mkdir /home/$username/.scripts
if [ "$username" == "ngrogg" ]; then
cp /home/$username/Documents/gits/notes/backupwiki.sh /home/$username/.scripts/wikitogit.sh
cp /home/$username/Documents/gits/notes/restorewiki.sh /home/$username/.scripts/wikifromgit.sh
else
cp /home/$username/Documents/gits/notes/restorewiki.sh /home/$username/.scripts/wikifromgit.sh
fi
#### If user didn't take zsh, add alias to bashrc
if [ "$zshYes" == "no" ]; then
echo "Adding alias wikifromgit to update vimwiki from git repo to bashrc"
echo "alias wikifromgit='bash ~/.scripts/wikifromgit.sh'" >> /home/$username/.bashrc
fi
#### If user doesn't want vimwiki configured
else
echo "Skipping vimwiki configuration"
fi
## Prompt for reboot
echo "Initial configuration complete, system needs to be rebooted to finish configuration"
echo "Would you like to reboot? y/n"
read confirm
if [ "$confirm" == "y" || "$confirm" == "Y" ]; then
sudo reboot
else
echo "Please reboot when able"
fi