pep-mklive/build-x86-images.sh

201 lines
7.0 KiB
Bash
Raw Normal View History

2024-10-27 15:16:46 -01:00
#!/bin/sh
set -eu
. ./lib.sh
PROGNAME=$(basename "$0")
ARCH=$(uname -m)
IMAGES="base"
TRIPLET=
REPO=
DATE=$(date -u +%Y%m%d)
usage() {
cat <<-EOH
Usage: $PROGNAME [options ...] [-- mklive options ...]
Wrapper script around mklive.sh for several standard flavors of live images.
2024-10-27 19:09:07 -01:00
Adds pep-installer and other helpful utilities to the generated images.
2024-10-27 15:16:46 -01:00
OPTIONS
-a <arch> Set XBPS_ARCH in the image
-b <variant> One of base, enlightenment, xfce, mate, cinnamon, gnome, kde,
lxde, or lxqt (default: base). May be specified multiple times
to build multiple variants
-d <date> Override the datestamp on the generated image (YYYYMMDD format)
-t <arch-date-variant>
Equivalent to setting -a, -b, and -d
-r <repo> Use this XBPS repository. May be specified multiple times
-h Show this help and exit
-V Show version and exit
Other options can be passed directly to mklive.sh by specifying them after the --.
See mklive.sh -h for more details.
EOH
}
while getopts "a:b:d:t:hr:V" opt; do
case $opt in
a) ARCH="$OPTARG";;
b) IMAGES="$OPTARG";;
d) DATE="$OPTARG";;
r) REPO="-r $OPTARG $REPO";;
t) TRIPLET="$OPTARG";;
V) version; exit 0;;
h) usage; exit 0;;
*) usage >&2; exit 1;;
esac
done
shift $((OPTIND - 1))
INCLUDEDIR=$(mktemp -d)
trap "cleanup" INT TERM
cleanup() {
rm -rf "$INCLUDEDIR"
}
setup_pipewire() {
PKGS="$PKGS pipewire alsa-pipewire"
mkdir -p "$INCLUDEDIR"/etc/xdg/autostart
ln -sf /usr/share/applications/pipewire.desktop "$INCLUDEDIR"/etc/xdg/autostart/
mkdir -p "$INCLUDEDIR"/etc/pipewire/pipewire.conf.d
ln -sf /usr/share/examples/wireplumber/10-wireplumber.conf "$INCLUDEDIR"/etc/pipewire/pipewire.conf.d/
ln -sf /usr/share/examples/pipewire/20-pipewire-pulse.conf "$INCLUDEDIR"/etc/pipewire/pipewire.conf.d/
mkdir -p "$INCLUDEDIR"/etc/alsa/conf.d
ln -sf /usr/share/alsa/alsa.conf.d/50-pipewire.conf "$INCLUDEDIR"/etc/alsa/conf.d
ln -sf /usr/share/alsa/alsa.conf.d/99-pipewire-default.conf "$INCLUDEDIR"/etc/alsa/conf.d
}
build_variant() {
variant="$1"
shift
2024-10-27 19:09:07 -01:00
IMG=pep-live-${ARCH}-${DATE}-${variant}.iso
2024-10-27 15:16:46 -01:00
GRUB_PKGS="grub-i386-efi grub-x86_64-efi"
A11Y_PKGS="espeakup void-live-audio brltty"
PKGS="dialog octoxbps cryptsetup lvm2 mdadm void-docs-browse xtools-minimal xmirror chrony $A11Y_PKGS $GRUB_PKGS"
XORG_PKGS="xorg xorg-input-drivers xorg-video-drivers setxkbmap xauth font-misc-misc terminus-font dejavu-fonts-ttf orca"
SERVICES="sshd chronyd"
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)
2024-10-28 11:24:03 -01:00
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
2024-11-01 13:02:14 -01:00
mousepad mugshot menulibre thunar-archive-plugin thunar-volman xfce4-panel-profiles xfce4 xfce4-plugins xfce4-screenshooter xarchiver alsa-utils bluez bluez-cups btop console-setup cups
curl dconf-editor dbus-x11 cantarell-fonts liberation-fonts-ttf git wget gnome-disk-utility gparted gvfs samba samba-cups cups-pdf avahi inxi network-manager-applet ntp python3-pipx
python3-tkinter python3-requests python3-certifi python3-Pillow system-config-printer simple-scan smartmontools smbclient spice-vdagent sqlite openssh nano vim-x11 vim linux-firmware
broadcom-bt-firmware alsa-firmware linux-firmware-qualcomm qemu-firmware sof-firmware blueman xf86-video-intel"
2024-10-27 19:09:07 -01:00
SERVICES="$SERVICES dbus lightdm NetworkManager polkitd bluetoothd cupsd avahi-daemon ntpd smbd nmbd sshd spice-vdagentd"
2024-10-27 15:16:46 -01:00
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 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 lightdm NetworkManager polkitd"
LIGHTDM_SESSION=cinnamon
;;
gnome)
PKGS="$PKGS $XORG_PKGS gnome firefox"
SERVICES="$SERVICES dbus gdm NetworkManager polkitd"
;;
kde)
PKGS="$PKGS $XORG_PKGS kde5 konsole firefox dolphin NetworkManager"
SERVICES="$SERVICES dbus 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 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} "$@"
cleanup
}
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"
2024-10-27 19:09:07 -01:00
install -Dm755 "$installer" "$INCLUDEDIR"/usr/bin/pep-installer
2024-10-27 15:16:46 -01:00
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
move_isos() {
echo "Movendo as ISOs para /var/www/html..."
2024-10-27 19:09:07 -01:00
mv pep-live-${ARCH}-${DATE}-*.iso /var/www/html/ || { echo "Erro ao mover as ISOs"; exit 1; }
2024-10-27 15:16:46 -01:00
}
# No final do script, após a chamada de build_variant
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
move_isos