blob: 19e5148c22cf5bf8b0805ec5329bfec5ad43f902 (
plain)
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
|
#!/bin/sh
cd "$(dirname "$0")"
. ../lib/bootstrap
wrong_call() {
cat << EOF
run this script as root and with the username of your user account
examples:
$ sudo $0 loek
$ sudo $0 "\$LOGNAME"
# $0 gert
EOF
exit 1
}
# this script needs to run with root privileges
[ $(id -u) -ne 0 ] && wrong_call
# SETUP_USER must exist
SETUP_USER="$1"
s getent passwd "$SETUP_USER" || wrong_call
# SETUP_USER can not be root
[ $(id -u "$SETUP_USER") -eq 0 ] && wrong_call
begintask "copy system config files"
s cp -r etc/. /etc
endtask
begintask "set pinentry program to pinentry-gnome3 (GTK 3)"
s ln -sf pinentry-gnome3 "$(command -v pinentry)"
endtask
begintask "enabling services"
s systemctl enable bluetooth ntpd cups
endtask
GROUPS_OK=1
CURRENT_GROUPS="$(id -Gn "$SETUP_USER")"
TARGET_GROUPS="users uucp optical lp audio wheel input"
for group in $TARGET_GROUPS ; do
if ! echo "$CURRENT_GROUPS" | s grep "$group" ; then
GROUPS_OK=0
break
fi
done
[ "$GROUPS_OK" -ne 1 ] && (
begintask "adding $SETUP_USER to groups"
s usermod -aG "$(echo "$TARGET_GROUPS" | tr ' ' ',')" "$SETUP_USER"
endtask
)
PAM_GNUPG_FILE="/etc/pam.d/system-login"
! s grep 'pam_gnupg' "$PAM_GNUPG_FILE" && (
begintask "adding pam-gnupg PAM module"
cat << EOF >> "$PAM_GNUPG_FILE"
# https://github.com/cruegge/pam-gnupg
auth optional pam_gnupg.so store-only
session optional pam_gnupg.so
EOF
endtask
)
s grep '^#\s*\<Color\>' /etc/pacman.conf && (
begintask "enabling color in /etc/pacman.conf"
s sed 's/^#\s*\(\<Color\>\)/\1/g' -i /etc/pacman.conf
endtask
)
|