-
Notifications
You must be signed in to change notification settings - Fork 19
/
build-x86-images.sh
executable file
·153 lines (136 loc) · 5.07 KB
/
build-x86-images.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
#!/bin/sh
set -eu
. ./lib.sh
PROGNAME=$(basename "$0")
ARCH=$(uname -m)
IMAGES="base enlightenment xfce mate cinnamon gnome kde lxde lxqt"
TRIPLET=
REPO=
DATE=$(date -u +%Y%m%d)
help() {
echo "$PROGNAME: [-a arch] [-b base|enlightenment|xfce|mate|cinnamon|gnome|kde|lxde|lxqt] [-d date] [-t arch-date-variant] [-r repo]" >&2
}
while getopts "a:b:d:t:hr:V" opt; do
case $opt in
a) ARCH="$OPTARG";;
b) IMAGES="$OPTARG";;
d) DATE="$OPTARG";;
h) help; exit 0;;
r) REPO="-r $OPTARG $REPO";;
t) TRIPLET="$OPTARG";;
V) version; exit 0;;
*) help; exit 1;;
esac
done
shift $((OPTIND - 1))
INCLUDEDIR=$(mktemp -d)
trap "cleanup" INT TERM
cleanup() {
rm -r "$INCLUDEDIR"
}
setup_pipewire() {
PKGS="$PKGS pipewire alsa-pipewire"
mkdir -p "$INCLUDEDIR"/etc/xdg/autostart
ln -s /usr/share/applications/pipewire.desktop "$INCLUDEDIR"/etc/xdg/autostart/
mkdir -p "$INCLUDEDIR"/etc/pipewire/pipewire.conf.d
ln -s /usr/share/examples/wireplumber/10-wireplumber.conf "$INCLUDEDIR"/etc/pipewire/pipewire.conf.d/
ln -s /usr/share/examples/pipewire/20-pipewire-pulse.conf "$INCLUDEDIR"/etc/pipewire/pipewire.conf.d/
mkdir -p "$INCLUDEDIR"/etc/alsa/conf.d
ln -s /usr/share/alsa/alsa.conf.d/50-pipewire.conf "$INCLUDEDIR"/etc/alsa/conf.d
ln -s /usr/share/alsa/alsa.conf.d/99-pipewire-default.conf "$INCLUDEDIR"/etc/alsa/conf.d
}
build_variant() {
variant="$1"
shift
IMG=void-live-${ARCH}-${DATE}-${variant}.iso
GRUB_PKGS="grub-i386-efi grub-x86_64-efi"
A11Y_PKGS="espeakup void-live-audio brltty"
PKGS="dialog cryptsetup lvm2 mdadm void-docs-browse xtools-minimal xmirror $A11Y_PKGS $GRUB_PKGS"
XORG_PKGS="xorg-minimal xorg-input-drivers xorg-video-drivers setxkbmap xauth font-misc-misc terminus-font dejavu-fonts-ttf orca"
SERVICES="sshd"
LIGHTDM_SESSION=''
case $variant in
base)
SERVICES="$SERVICES dhcpcd wpa_supplicant acpid"
;;
enlightenment)
PKGS="$PKGS $XORG_PKGS lightdm lightdm-gtk3-greeter enlightenment terminology udisks2 firefox"
SERVICES="$SERVICES acpid dhcpcd wpa_supplicant lightdm dbus polkitd"
LIGHTDM_SESSION=enlightenment
;;
xfce)
PKGS="$PKGS $XORG_PKGS lightdm lightdm-gtk3-greeter xfce4 gnome-themes-standard gnome-keyring network-manager-applet gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox xfce4-pulseaudio-plugin"
SERVICES="$SERVICES dbus elogind lightdm NetworkManager polkitd"
LIGHTDM_SESSION=xfce
;;
mate)
PKGS="$PKGS $XORG_PKGS lightdm lightdm-gtk3-greeter mate mate-extra gnome-keyring network-manager-applet gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox"
SERVICES="$SERVICES dbus elogind lightdm NetworkManager polkitd"
LIGHTDM_SESSION=mate
;;
cinnamon)
PKGS="$PKGS $XORG_PKGS lightdm lightdm-gtk3-greeter cinnamon gnome-keyring colord gnome-terminal gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox"
SERVICES="$SERVICES dbus elogind lightdm NetworkManager polkitd"
LIGHTDM_SESSION=cinnamon
;;
gnome)
PKGS="$PKGS $XORG_PKGS gnome firefox"
SERVICES="$SERVICES dbus elogind gdm NetworkManager polkitd"
;;
kde)
PKGS="$PKGS $XORG_PKGS kde5 konsole firefox dolphin"
SERVICES="$SERVICES dbus elogind NetworkManager sddm"
;;
lxde)
PKGS="$PKGS $XORG_PKGS lxde lightdm lightdm-gtk3-greeter gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox"
SERVICES="$SERVICES acpid dbus dhcpcd wpa_supplicant lightdm polkitd"
LIGHTDM_SESSION=LXDE
;;
lxqt)
PKGS="$PKGS $XORG_PKGS lxqt sddm gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox"
SERVICES="$SERVICES elogind dbus dhcpcd wpa_supplicant sddm polkitd"
;;
*)
>&2 echo "Unknown variant $variant"
exit 1
;;
esac
if [ -n "$LIGHTDM_SESSION" ]; then
mkdir -p "$INCLUDEDIR"/etc/lightdm
echo "$LIGHTDM_SESSION" > "$INCLUDEDIR"/etc/lightdm/.session
# needed to show the keyboard layout menu on the login screen
cat <<- EOF > "$INCLUDEDIR"/etc/lightdm/lightdm-gtk-greeter.conf
[greeter]
indicators = ~host;~spacer;~clock;~spacer;~layout;~session;~a11y;~power
EOF
fi
if [ "$variant" != base ]; then
setup_pipewire
fi
./mklive.sh -a "$ARCH" -o "$IMG" -p "$PKGS" -S "$SERVICES" -I "$INCLUDEDIR" ${REPO} "$@"
}
if [ ! -x mklive.sh ]; then
echo mklive.sh not found >&2
exit 1
fi
if [ -x installer.sh ]; then
MKLIVE_VERSION="$(PROGNAME='' version)"
installer=$(mktemp)
sed "s/@@MKLIVE_VERSION@@/${MKLIVE_VERSION}/" installer.sh > "$installer"
install -Dm755 "$installer" "$INCLUDEDIR"/usr/bin/void-installer
rm "$installer"
else
echo installer.sh not found >&2
exit 1
fi
if [ -n "$TRIPLET" ]; then
VARIANT="${TRIPLET##*-}"
REST="${TRIPLET%-*}"
DATE="${REST##*-}"
ARCH="${REST%-*}"
build_variant "$VARIANT" "$@"
else
for image in $IMAGES; do
build_variant "$image" "$@"
done
fi