-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy patharch_reinstall.sh
executable file
·311 lines (268 loc) · 8.22 KB
/
arch_reinstall.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
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
#!/bin/bash
# Fernando Carmona Varo <[email protected]>
#-----
# Dirty script I use for doing some rutine setup tasks when
# installing and configuring a new archlinux install.
#
# Note: I still didn't use it much, probably needs some love
#----
[email protected]:Ferk/xdg_config.git
set -a
trap finish EXIT
finish() {
if [ $? != 0 ]
then
echo "An error was found!! The script aborted"
fi
}
if [ "$PACMAN_CMD" ]
then
# Use whatever is specified as PACMAN_CMD without any further check
PACMAN=$PACMAN_CMD
else
PACMAN=$({ which yaourt || which packer || which pacman;} 2>/dev/null)
[ -z "$PACMAN" ] && {
echo "Can't find pacman package installer. Is your system Archlinux?"
exit 1
}
if [ $PACMAN = "pacman" ]
then
echo "no AUR installer found, downloading packer"
wget https://raw.github.com/keenerd/packer/master/packer && {
pacman -S jshon fakeroot
chmod +x /usr/bin/packer
PACMAN=/usr/bin/packer
}
fi
fi
######
#{{{ Function definitions
msg() {
echo -e "\e[33m ** \e[36m$@\e[0m"
}
confirm() {
echo "$@"
echo "Do you want to edit that? [yN]"
read edit
[ "$edit" = "N" ] && return
}
i() {
for pkg in $@
do
if pacman -Si $pkg >/dev/null
then
INSTALL_LIST="$INSTALL_LIST $pkg"
else
BADPKG_LIST="$BADPKG_LIST $pkg"
fi
done
}
o() {
printf "\n$@"
echo "Do you want to install these packages? [Yn]"
read edit
{ [ "$edit" = "n" ] || [ "$edit" = "N" ]; } && return
INSTALL_LIST="$INSTALL_LIST $@"
}
i_install() {
echo "Installing: $INSTALL_LIST"
# $PACMAN --noconfirm --needed -S $INSTALL_LIST
$PACMAN --noconfirm -S $INSTALL_LIST
echo "Packages that would not be found for installation: $BADPKG_LIST"
}
#######################
#{{{ Execution
if [ "$(id -u)" != 0 ]
then
echo "You need to be root to run this script"
exit 1
fi
#####{{{ User set up (add the right groups)
if [ "$USER" = "root" ]
then
echo "Enter username for the main user (empty for no user changes): "
read USER
fi
if [ "$USER" ]
then
id "$USER" || {
echo "Create new user '$USER'? (yN):"
read yn
if [ $yn = y ]
then
adduser $USER
else
break
fi
}
msg "Setting up groups for user \"$USER\""
# Group Affected files Purpose
G="$G adm" # /var/log/* Read access to log files in /var/log
G="$G audio" # /dev/sound/*, /dev/snd/*, /dev/misc/rtc0 Access to sound hardware.
#G="$G avahi" # ??
#G="$G bin" # /usr/bin/* Right to modify binaries only by root, but right to read or executed by anyone. (Please modify this for better understanding...)
#G="$G daemon" # ??
G="$G dbus" # /var/run/dbus
#G="$G disk" # /dev/sda[1-9], /dev/sdb[1-9], /dev/hda[1-9], etc Access to block devices not affected by other groups such as optical,floppy,storage.
G="$G floppy" # /dev/fd[0-9] Access to floppy drives.
G="$G ftp" # /srv/ftp
G="$G games" # /var/games Access to some game software.
#G="$G gdm" # ??
G="$G hal" # /var/run/hald, /var/cache/hald
G="$G http" # ??
G="$G kmem" # /dev/port, /dev/mem, /dev/kmem
G="$G locate" # /usr/bin/locate, /var/lib/locate, /var/lib/slocate, /var/lib/mlocate Right to use updatedb command.
G="$G log" # /var/log/* Access to log files in /var/log,
G="$G lp" # /etc/cups, /var/log/cups, /var/cache/cups, /var/spool/cups for printer hardware
#G="$G mem" # ??
G="$G mail" # /usr/bin/mail
G="$G network" # Right to change network settings such as when using a Networkmanager.
#G="$G nobody" # Unprivileged group.
G="$G optical" # /dev/sr[0-9], /dev/sg[0-9] Access to optical devices such as CD,CD-R,DVD,DVD-R.
G="$G power" # Right to use suspend utils.
#G="$G rfkill" # ??
#G="$G root" # /* -- ALL FILES! Complete system administration and control (root, admin)
G="$G scanner" # /var/lock/sane Access to scanner hardware.
G="$G smmsp" # sendmail group
G="$G storage" # Access to removable drives such as USB harddrives,flash/jump drives,mp3 players.
#G="$G stb-admin" # ??
#G="$G sys" # Right to admin printers in CUPS.
#G="$G thinkpad" # /dev/misc/nvram Right for thinkpad users using tools such as tpb.
#G="$G tty" # /dev/tty, /dev/vcc, /dev/vc, /dev/ptmx
G="$G users" # Standard users group.
G="$G uucp" # /dev/ttyS[0-9] /dev/tts/[0-9] USB devices, RS232 and serial ports.
G="$G video" # /dev/fb/0, /dev/misc/agpgart for video capture devices, DRI/3D hw acceleration.
G="$G wheel" # to use sudo (setup with visudo), Also affected by PAM
# non-default Groups
G="$G ntp" #
G="$G policykit" #
G="$G camera" # Access to Digital Cameras.
G="$G clamav" # /var/lib/clamav/*, /var/log/clamav/*
G="$G networkmanager" # to connect wirelessly with Networkmanager.
G="$G vboxusers" # /dev/vboxdrv to use Virtualbox software.
G="$G vmware" # to use VMware software.
G="$G games" # Permission to write to /var/games
G="$G systemd-journal"
for i in $G
do
sudo gpasswd -a $USER $i
done
msg "Groups for \"$USER\":"
groups $USER
fi
msg "Setting up locale"
ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
msg "Signing trusted master keys"
pacman-key --init
pacman-key --populate archlinux &>/dev/null || echo "Error found"
pacman-key --refresh-keys
#############
##{{{ Package installation
msg "Installing packages"
## basic
i base base-devel linux-tools
i xorg xorg-apps xorg-fonts xorg-utils xorg-xsetroot
i net-tools wpa_supplicant ethtool rfkill
i bash-completion sudo
## Language Tools
i dictd goldendict espeak google-translate
i dictd-gcide dictd-jargon dictd-vera #dictd-wn
i aspell aspell-es aspell-en aspell-de
i hunspell-es hunspell-en hunspell-de # for loffice/chromium
i gettext
i espeak
## Fonts
i ttf-google-fonts-git ttf-freefont ttf-liberation proggyfonts terminus-font bdf-unifont ttf-raghu ttf-ipa-mona ttf-monapo otf-ipafont
i ttf-ms-fonts ttf-vista-fonts
## Multimedia Tools
i imagemagick sxiv gimp gimp-webp-bzr #asciiview
i audio-convert vorbis-tools flac lame ffmpeg sox
i mpv
i cmus #xmms2
i icat-git imlib2-webp-git
i hsetroot
i pitivi
i cdparanoia
i exfalso exiv2
i jpegoptim
i pulseaudio paprefs pavucontrol
i submarine
## Development Tools
i emacs vim gdb jed the_silver_searcher
i automake cmake
i openssh x11-ssh-askpass git bzr subversion
i checkbashisms
i cscope ctags
## Misc Commandline Tools
#i tct # http://www.linux-mag.com/id/1889/
i ed lsof lsw ncdu lesspipe dtach dvtm moreutils xprintidle mlocate
i stderred-git #rmshit-git #screenfo
i atool unrar zip unzip unarj p7zip xz bzip2
i minicom
i pm-utils
i lm_sensors
i acpi
## Networking
i openssh keychain #gpg
i aircrack-ng
## Internet
i firefox chromium netsurf elinks
i chromium-libpdf chromium-pepper-flash
i google-talkplugin flashplugin
i rtorrent #transmission-gtk tucan-hg
i nmap gnu-netcat aircrack-ng
i dnsmasq dnsutils netcfg wireless_tools wpa_supplicant wpa_actiond ifplugd
i curl
i youtube-dl
# eBooks/Documents
i fbreader
i evince
i pdfedit
i texlive-most
# Disk management and recovery utilities
i parted gparted ntfs-3g
i testdisk
## Desktop Environment related
i slock swarp dmenu dwm-sprinkles
i inotify-tools
i xorg-xmessage xosd beep xsel
i rxvt-unicode
i thunar thunar-archive-plugin
i xbindkeys xclip xsel xmacro
i mimeo xdg-utils-mimeo
i slim
i unagi
# IM
i pidgin finch irssi
## Games and other silly stuff
i fortune-mod cowsay bsd-games
i nethack stone-soup hydraslayer tintin moon-buggy bastet enigma curseofwar cavez-of-fear cataclysm-dda
i puzzles pychess
i cheese
i fceux zsnes-netplay
i_install
echo -e "\a"
[ -f /usr/bin/beep ] && {
sudo chmod 4755 /usr/bin/beep
beep
}
dconf write /org/gnome/desktop/interface/gtk-key-theme "'Emacs'"
##################
################### this step after git is installed
msg "Fetching configuration files from $GIT_CONFIG_REPO"
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config/}"
if [ -d "$XDG_CONFIG_HOME/.git" ]; then
cd $XDG_CONFIG_HOME
git pull
else
if [ -d "$XDG_CONFIG_HOME" ]; then
# Move the existing .config to backup it
mv "$XDG_CONFIG_HOME" "${XDG_CONFIG_HOME}.old"
fi
mkdir -p $XDG_CONFIG_HOME
git clone -q $GIT_CONFIG_REPO "$XDG_CONFIG_HOME"
fi && {
"$XDG_CONFIG_HOME/symlink.sh"
}
###################
msg "Successfully finished."