summaryrefslogtreecommitdiff
path: root/setup-desktop.in
blob: 574582a025d1da929a0540a260c90a8dedc2da82 (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
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
#!/bin/sh

PREFIX=@PREFIX@
: ${LIBDIR=$PREFIX/lib}
. "$LIBDIR/libalpine.sh"

usage() {
	cat <<-__EOF__
		usage: setup-desktop [-h] [xfce|gnome]

		Install a standard desktop

		options:
		 -h  Show this help

	__EOF__
	exit $1
}

while getopts "h" opt; do
	case $opt in
		h) usage 0;;
		'?') usage "1" >&2;;
	esac
done
shift $(($OPTIND - 1))

if [ $# -gt 1 ]; then
	usage "1" >&2
fi

if [ $# -eq 0 ]; then
	users=$(awk -F: '{if ($3<65000 && $3 >= 1000) print $1}' "$ROOT"/etc/passwd 2>/dev/null)
	if [ -z "$users" ]; then
		setup-user -g "audio,video,netdev"
	fi
fi

de="$1"

valid_desktops="xfce gnome plasma none"
if [ $# -eq 1 ] && ! isin "$de" $valid_desktops; then
	echo "$de is not a valid desktop" >&2
	usage "1" >&2
fi
shift

while ! isin "$de" $valid_desktops; do
	ask "Which desktop environment? ('gnome', 'plasma', 'xfce' or 'none')" none
	de="$resp"
done

case "$de" in
	none)
		exit 0
		;;
	xfce)
		setup-xorg-base xfce4 ${BROWSER:-firefox} \
			consolekit2 \
			gvfs \
			lightdm \
			lightdm-gtk-greeter \
			polkit \
			xfce4-terminal \
			"$@"
		rc-update add lightdm
		;;
	gnome)
		setup-xorg-base ${BROWSER:-firefox} gnome gnome-apps-core "$@"
		rc-update add gdm
		;;
	plasma)
		setup-xorg-base ${BROWSER:-firefox} \
			ark \
			bluedevil \
			breeze \
			breeze-gtk \
			breeze-icons \
			dbus \
			discover \
			drkonqi \
			font-noto \
			gwenview \
			kate \
			kde-cli-tools \
			kde-gtk-config \
			kdeplasma-addons \
			kgamma5 \
			khotkeys \
			kinfocenter \
			kio-fuse \
			kmenuedit \
			konsole \
			kscreen \
			ksshaskpass \
			kwallet-pam \
			kwayland-integration \
			pinentry-qt \
			plasma-browser-integration \
			plasma-desktop \
			plasma-disks \
			plasma-nm \
			plasma-pa \
			plasma-systemmonitor \
			plasma-vault \
			plasma-workspace-wallpapers \
			polkit-elogind \
			polkit-kde-agent-1 \
			print-manager \
			powerdevil \
			sddm-breeze \
			sddm-kcm \
			spectacle \
			systemsettings \
			udisks2 \
			xdg-desktop-portal-kde \
			xdg-user-dirs \
			"$@"
		rc-update add dbus
		rc-update add sddm
		;;
	*)
		usage "1" >&2
		;;
esac

users=$(awk -F: '{if ($3<65000 && $3 >= 1000) print $1}' "$ROOT"/etc/passwd 2>/dev/null)
if [ -z "$users" ]; then
	echo "WARNING: You need to create a user account. Please run: setup-user" >&2
	echo "" >&2
fi