-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnewsystem.sh
executable file
·128 lines (104 loc) · 3.44 KB
/
newsystem.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
#! /usr/bin/env bash
ENV=`dirname "$(readlink -f "$BASH_SOURCE")"`
LN="ln -fs"
# Install some useful packages
sudo apt install -y curl git screen bmon python3-full xclip
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo "Platform: $OSTYPE"
elif [[ "$OSTYPE" == "freebsd"* ]]; then
echo "Platform: I Love $OSTYPE but,"
echo "Operating system $OSTYPE is not supported!"
exit 1
else
echo "Operating system $OSTYPE is not supported!"
exit 1
fi
read -p "Do you want disable apport? [N/y] "
if [[ $REPLY =~ ^[Yy]$ ]]; then
sudo systemctl disable apport.service
sudo systemctl mask apport.service
fi
read -p "Do you want disable user-tracker, apport and some background tasks? [N/y] "
if [[ $REPLY =~ ^[Yy]$ ]]; then
tracker reset --hard
sudo systemctl disable tracker-{miner-apps,miner-fs,miner-rss,store,extract,writeback}
systemctl --user mask tracker-{miner-apps,miner-fs,miner-rss,store,extract,writeback}
sudo apt-mark hold tracker-{miner-fs,extract}
sudo chmod -x /usr/libexec/tracker-miner-fs-3
sudo chmod -x /usr/libexec/tracker-extract-3
tracker3 reset --filesystem --rss # Clean all database
tracker3 daemon --terminate
fi
function linkfile {
if [ -f $2 ]; then
read -p "Do you want to overwrite sym-link: '$2'? [N/y] "
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo "Overwriting: $2"
# do dangerous stuff
else
return
fi
fi
$LN $1 $2
}
read -p "Do you want to install Vim plugins? [N/y] "
if [[ $REPLY =~ ^[Yy]$ ]]; then
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
python3 -m venv ${HOME}/.vim/pyenv
fi
# bash
read -p "Do you want to update the .bash_aliases? [N/y] "
if [[ $REPLY =~ ^[Yy]$ ]]; then
linkfile "${ENV}/bash_aliases" "${HOME}/.bash_aliases"
fi
# inputrc
read -p "Do you want to update the .inputrc to enable VI editing mode? [N/y] "
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo 'set editing-mode vi' > "${HOME}/.inputrc"
fi
# vim
read -p "Do you want to create .vimrc? [N/y] "
if [[ $REPLY =~ ^[Yy]$ ]]; then
linkfile "${ENV}/vimrc" "${HOME}/.vimrc"
fi
# default editor
read -p "Do you want to set vim as the default editor? [N/y] "
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo 'export EDITOR=/usr/bin/vim' | sudo tee /etc/profile.d/editor.sh \
> /dev/null
fi
# ssh
read -p "Do you want to update the SSH config? [N/y] "
if [[ $REPLY =~ ^[Yy]$ ]]; then
mkdir -p "${HOME}/.ssh/sshcontrolmasters"
linkfile "${ENV}/sshconfig" "${HOME}/.ssh/config"
fi
# terminator
read -p "Do you want to update the Terminator config and theme? [N/y] "
if [[ $REPLY =~ ^[Yy]$ ]]; then
mkdir -p "${HOME}/.config/terminator"
linkfile "${ENV}/terminatorconfig" "${HOME}/.config/terminator/config"
linkfile "${ENV}/gtk.css" "${HOME}/.config/gtk-3.0/gtk.css"
fi
# WireGuard
read -p "Do you want to install wireguard? [N/y] "
if [[ $REPLY =~ ^[Yy]$ ]]; then
sudo apt install wireguard
sudo ln -s "${ENV}/wgctl.sh" "/usr/local/bin/wgctl"
fi
# Rotation sensor is anoyying.
read -p "Do you want to remove the io-sensor-proxy package? [N/y] "
if [[ $REPLY =~ ^[Yy]$ ]]; then
sudo apt remove iio-sensor-proxy
sudo systemctl stop iio-sensor-proxy.service
sudo systemctl disable iio-sensor-proxy.service
else
read -p "Do you want to stop and disable the io-sensor-proxy package? [N/y] "
if [[ $REPLY =~ ^[Yy]$ ]]
then
sudo systemctl stop iio-sensor-proxy.service
sudo systemctl disable iio-sensor-proxy.service
fi
fi