-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-basic-desktop.sh
executable file
·92 lines (73 loc) · 3.13 KB
/
setup-basic-desktop.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
#!/bin/bash
#function to install apps with a clean display
function retryinstall
{
echo -e "[\033[33m-\e[0m] Retrying..."
DEBIAN_FRONTEND=noninteractive apt-get --fix-broken install -yq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" >/dev/null 2>/dev/nul
DEBIAN_FRONTEND=noninteractive apt-get install --fix-missing -yq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" >/dev/null 2>/dev/nul
DEBIAN_FRONTEND=noninteractive apt-get install -yq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" $1 >/dev/null 2>/dev/null && echo -e "[\033[32m*\e[0m]OK" || echo -e "[\033[31m-\e[0m] FAILED Exiting now... Check apt isn't running & try again"; exit 1
}
function install
{
echo -n "Installing: $1 "
DEBIAN_FRONTEND=noninteractive apt-get install -yq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" $1 >/dev/null 2>/dev/null && echo -e "[\033[32m*\e[0m]OK" || retryinstall $1
}
##### Main #####
USERN=drop
#Check Sudo
if [[ $EUID -ne 0 ]]; then
echo "This script must be run with sudo"
exit 1
fi
#Check working directory
FILE=.zshrc
if test -f "$FILE"; then
echo -e "Working Directory Check: [\033[32m*\e[0m]OK"
else
echo -e "Working Directory Check: [\033[31m-\e[0m] FAILED"
echo "Please change to the downloaded direectory with file and run directly from there"
echo "This script will now exit"
exit
fi
#Get the Standard Users username
inuser=$SUDO_USER
#install oh my zsh
install curl
install zsh
echo -e "Installing: Oh my ZSH from external provider [-]"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 0<&-
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
echo -e "Oh my ZSH installation: [\033[33m-\e[0m] Check after logon"
#ensure shell changed
usermod -s /usr/bin/zsh ${inuser}
echo -e "${inuser} shell: changed to zsh [\033[32m*\e[0m]OK"
#Install Applications
install vim
install git
install powerline
install cowsay
install fortune
install terminator
install snap
install locate
install vim-airline
install vim-airline-themes
snap install code --classic
#copy files to correct directories
cp rssh.conf /etc/rssh.conf
cp .vimrc /home/${inuser}/
chown $inuser:$inuser /home/$inuser/.vimrc
cp .zshrc /home/${inuser}/
chown $inuser:$inuser /home/$inuser/.zshrc
echo -e "Copy Config Files: [\033[32m*\e[0m]OK"
cp -r ~/.oh-my-zsh /home/${inuser}/
chown -R $inuser:$inuser /home/$inuser/.oh-my-zsh
cp agnoster.zsh.theme /home/${inuser}/.oh-my-zsh/themes/agnoster.zsh-theme
#remove my username with set username
sed -i -e "s/setupuser/"${inuser}"/g" /home/"${inuser}"/zshrc
sed -i -e "s/root/"${inuser}"/g" /home/"${inuser}"/.zshrc
sed -i -e "s/user/"${inuser}"/g" /home/"${inuser}"/.zshrc
echo "fortune | cowsay" >> /home/"${inuser}"/.zshrc
echo -e "[\033[32m*Setup Complete*\e[0m]: Please log out and back in"
git restore .zshrc >/dev/null 2>/dev/nul