Commits (28)
......@@ -5,6 +5,7 @@ image: zaoqi/voidlinux-ci
pages:
stage: deploy
script:
- xbps-install -Suy xbps
- xbps-install -Suy
- xbps-install -Sy make bash lzo kmod dosfstools e2fsprogs zsync git
- make
......
......@@ -7,3 +7,5 @@ Branches:
- master merges split when ready to publish
`git merge split`
CI builds can be monitored at https://gitlab.com/kevcrumb/split-mklive/-/jobs
Resulting ISO's are listed at https://kevcrumb.gitlab.io/split-mklive/index.html
# 1) use alpine to generate a void environment
FROM alpine:3.12 as stage0
ARG REPOSITORY=https://alpha.de.repo.voidlinux.org
ARG REPOSITORY=https://repo-default.voidlinux.org
ARG ARCH=x86_64
COPY keys/* /target/var/db/xbps/keys/
RUN apk add ca-certificates curl && \
......@@ -14,7 +14,7 @@ RUN apk add ca-certificates curl && \
# 2) using void to generate the final build
FROM scratch as stage1
ARG REPOSITORY=https://alpha.de.repo.voidlinux.org
ARG REPOSITORY=https://repo-default.voidlinux.org
ARG ARCH=x86_64
ARG BASEPKG=base-minimal
COPY --from=stage0 /target /
......
GITVER := $(shell git rev-parse --short HEAD)
VERSION = 0.22
VERSION = 0.23
SHIN += $(shell find -type f -name '*.sh.in')
SCRIPTS += $(SHIN:.sh.in=.sh)
DATECODE=$(shell date "+%Y%m%d")
SHELL=/bin/bash
T_PLATFORMS=rpi{,2,3,4}{,-musl} beaglebone{,-musl} cubieboard2{,-musl} odroid-c2{,-musl} GCP{,-musl} pinebookpro{,-musl}
T_PLATFORMS=rpi-{armv{6,7}l,aarch64}{,-musl} beaglebone{,-musl} cubieboard2{,-musl} odroid-c2{,-musl} GCP{,-musl} pinebookpro{,-musl}
T_ARCHS=i686 x86_64{,-musl} armv{6,7}l{,-musl} aarch64{,-musl}
T_SBC_IMGS=rpi{,2,3,4}{,-musl} beaglebone{,-musl} cubieboard2{,-musl} odroid-c2{,-musl} pinebookpro{,-musl}
T_SBC_IMGS=rpi-{armv{6,7}l,aarch64}{,-musl} beaglebone{,-musl} cubieboard2{,-musl} odroid-c2{,-musl} pinebookpro{,-musl}
T_CLOUD_IMGS=GCP{,-musl}
T_PXE_ARCHS=x86_64{,-musl}
......@@ -31,7 +31,7 @@ ALL_MASTERDIRS=$(foreach arch,$(MASTERDIRS), masterdir-$(arch))
SUDO := sudo
XBPS_REPOSITORY := -r https://alpha.de.repo.voidlinux.org/current -r https://alpha.de.repo.voidlinux.org/current/musl -r https://alpha.de.repo.voidlinux.org/current/aarch64
XBPS_REPOSITORY := -r https://repo-default.voidlinux.org/current -r https://repo-default.voidlinux.org/current/musl -r https://repo-default.voidlinux.org/current/aarch64
COMPRESSOR_THREADS=2
%.sh: %.sh.in
......
#!/bin/sh
ARCH=
IMAGE=
set -eu
ARCH=$(uname -m)
IMAGES="base enlightenment xfce mate cinnamon gnome kde lxde lxqt"
REPO=
DATE=$(date +%Y%m%d)
help() {
echo "${0#/*}: [-a arch] [-b base|enlightenment|xfce|mate|cinnamon|gnome|kde|lxde|lxqt|split] [-r repo]" >&2
}
while getopts "a:b:hr:" opt; do
case $opt in
a) ARCH="$OPTARG";;
b) IMAGE="$OPTARG";;
h) echo "${0#/*}: [-a arch] [-b base|e|xfce|mate|cinnamon|gnome|kde|lxde|lxqt|split] [-r repo]" >&2; exit 1;;
r) REPO="-r $OPTARG $REPO";;
a) ARCH="$OPTARG";;
b) IMAGES="$OPTARG";;
h) help; exit 0;;
r) REPO="-r $OPTARG $REPO";;
*) help; exit 1;;
esac
done
shift $((OPTIND - 1))
: ${ARCH:=$(uname -m)}
readonly DATE=$(date +%Y%m%d)
readonly BASE_IMG=void-live-${ARCH}-${DATE}.iso
readonly E_IMG=void-live-${ARCH}-${DATE}-enlightenment.iso
readonly XFCE_IMG=void-live-${ARCH}-${DATE}-xfce.iso
readonly MATE_IMG=void-live-${ARCH}-${DATE}-mate.iso
readonly CINNAMON_IMG=void-live-${ARCH}-${DATE}-cinnamon.iso
readonly GNOME_IMG=void-live-${ARCH}-${DATE}-gnome.iso
readonly KDE_IMG=void-live-${ARCH}-${DATE}-kde.iso
readonly LXDE_IMG=void-live-${ARCH}-${DATE}-lxde.iso
readonly LXQT_IMG=void-live-${ARCH}-${DATE}-lxqt.iso
readonly SPLIT_IMG=split-live-${ARCH}-${DATE}.iso
readonly GRUB="grub-i386-efi grub-x86_64-efi"
build_variant() {
variant="$1"
IMG=void-live-${ARCH}-${DATE}-${variant}.iso
[ "${variant}" = 'split' ] && IMG=split-live-${ARCH}-${DATE}.iso
GRUB_PKGS="grub-i386-efi grub-x86_64-efi"
PKGS="dialog cryptsetup lvm2 mdadm void-docs-browse xtools-minimal $GRUB_PKGS"
XORG_PKGS="xorg-minimal xorg-input-drivers xorg-video-drivers setxkbmap xauth font-misc-misc terminus-font dejavu-fonts-ttf alsa-plugins-pulseaudio"
SERVICES="sshd"
readonly BASE_PKGS="dialog cryptsetup lvm2 mdadm void-docs-browse $GRUB"
readonly X_PKGS="$BASE_PKGS xorg-minimal xorg-input-drivers xorg-video-drivers setxkbmap xauth font-misc-misc terminus-font dejavu-fonts-ttf alsa-plugins-pulseaudio"
readonly E_PKGS="$X_PKGS lxdm enlightenment terminology udisks2 firefox-esr"
readonly XFCE_PKGS="$X_PKGS lxdm xfce4 gnome-themes-standard gnome-keyring network-manager-applet gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox-esr"
readonly MATE_PKGS="$X_PKGS lxdm mate mate-extra gnome-keyring network-manager-applet gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox-esr"
readonly CINNAMON_PKGS="$X_PKGS lxdm cinnamon gnome-keyring colord gnome-terminal gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox-esr"
readonly GNOME_PKGS="$X_PKGS gnome gnome-terminal firefox-esr"
readonly KDE_PKGS="$X_PKGS kde5 konsole firefox dolphin"
readonly LXDE_PKGS="$X_PKGS lxdm lxde gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox-esr"
readonly LXQT_PKGS="$X_PKGS lxdm lxqt gvfs-afc gvfs-mtp gvfs-smb udisks2 qupzilla"
readonly SPLIT_PKGS="$X_PKGS splitlinux-tor-router splitlinux-lxc-conf"
case $variant in
base)
SERVICES="$SERVICES dhcpcd wpa_supplicant acpid"
;;
enlightenment)
PKGS="$PKGS $XORG_PKGS lxdm enlightenment terminology udisks2 firefox"
SERVICES="$SERVICES acpid dhcpcd wpa_supplicant lxdm dbus polkitd"
;;
xfce)
PKGS="$PKGS $XORG_PKGS lxdm xfce4 gnome-themes-standard gnome-keyring network-manager-applet gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox"
SERVICES="$SERVICES dbus elogind lxdm NetworkManager polkitd"
;;
mate)
PKGS="$PKGS $XORG_PKGS lxdm mate mate-extra gnome-keyring network-manager-applet gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox"
SERVICES="$SERVICES dbus elogind lxdm NetworkManager polkitd"
;;
cinnamon)
PKGS="$PKGS $XORG_PKGS lxdm cinnamon gnome-keyring colord gnome-terminal gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox"
SERVICES="$SERVICES dbus elogind lxdm NetworkManager polkitd"
;;
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 lxdm gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox"
SERVICES="$SERVICES acpid dbus dhcpcd wpa_supplicant lxdm polkitd"
;;
lxqt)
PKGS="$PKGS $XORG_PKGS lxqt lxdm gvfs-afc gvfs-mtp gvfs-smb udisks2 firefox"
SERVICES="$SERVICES elogind dbus dhcpcd wpa_supplicant lxdm polkitd"
;;
split)
PKGS="$PKGS $XORG_PKGS splitlinux-tor-router splitlinux-lxc-conf"
SERVICES="acpid containerd dbus dhcpcd docker lxc-autostart splitlinux-tor-router wpa_supplicant"
;;
*)
>&2 echo "Unknown variant $variant"
exit 1
;;
esac
[ ! -x mklive.sh ] && exit 0
./mklive.sh -a "$ARCH" -o "$IMG" -p "$PKGS" -S "$SERVICES" ${REPO} "$@"
}
if [ -z "$IMAGE" -o "$IMAGE" = base ]; then
if [ ! -e $BASE_IMG ]; then
./mklive.sh -a $ARCH -o $BASE_IMG -p "$BASE_PKGS" ${REPO} "$@"
fi
fi
if [ -z "$IMAGE" -o "$IMAGE" = e ]; then
if [ ! -e $E_IMG ]; then
./mklive.sh -a $ARCH -o $E_IMG -p "$E_PKGS" ${REPO} "$@"
fi
fi
if [ -z "$IMAGE" -o "$IMAGE" = xfce ]; then
if [ ! -e $XFCE_IMG ]; then
./mklive.sh -a $ARCH -o $XFCE_IMG -p "$XFCE_PKGS" ${REPO} "$@"
fi
fi
if [ -z "$IMAGE" -o "$IMAGE" = mate ]; then
if [ ! -e $MATE_IMG ]; then
./mklive.sh -a $ARCH -o $MATE_IMG -p "$MATE_PKGS" ${REPO} "$@"
fi
fi
if [ -z "$IMAGE" -o "$IMAGE" = cinnamon ]; then
if [ ! -e $CINNAMON_IMG ]; then
./mklive.sh -a $ARCH -o $CINNAMON_IMG -p "$CINNAMON_PKGS" ${REPO} "$@"
fi
if [ ! -x mklive.sh ]; then
echo mklive.sh not found >&2
exit 1
fi
if [ -z "$IMAGE" -o "$IMAGE" = gnome ]; then
if [ ! -e $GNOME_IMG ]; then
./mklive.sh -a $ARCH -o $GNOME_IMG -p "$GNOME_PKGS" ${REPO} "$@"
fi
fi
if [ -z "$IMAGE" -o "$IMAGE" = lxde ]; then
if [ ! -e $LXDE_IMG ]; then
./mklive.sh -a $ARCH -o $LXDE_IMG -p "$LXDE_PKGS" ${REPO} "$@"
fi
fi
if [ -z "$IMAGE" -o "$IMAGE" = lxqt ]; then
if [ ! -e $LXQT_IMG ]; then
./mklive.sh -a $ARCH -o $LXQT_IMG -p "$LXQT_PKGS" ${REPO} "$@"
fi
fi
if [ "$IMAGE" = kde ]; then
if [ ! -e $KDE_IMG ]; then
./mklive.sh -a $ARCH -o $KDE_IMG -p "$KDE_PKGS" ${REPO} "$@"
fi
fi
if [ "$IMAGE" = split ]; then
if [ ! -e $SPLIT_IMG ]; then
./mklive.sh -a $ARCH -o $SPLIT_IMG -p "$SPLIT_PKGS" ${REPO} $@
fi
fi
for image in $IMAGES; do
build_variant "$image"
done
......@@ -18,7 +18,7 @@ Linux container/identity:
create_voidlinux_container <name> <id> [musl]
If you omit the "musl" option the container is created as glibc. This looses
If you omit the "musl" option, the container is created as glibc. This looses
you some coolness-points, but causes more applications to work properly.
......
......@@ -20,8 +20,8 @@
# XBPS Configuration
# ===
# xbpsrepository: which repo should the install pull from
# default: http://alpha.de.repo.voidlinux.org/current
#xbpsrepository="http://alpha.de.repo.voidlinux.org/current"
# default: https://repo-default.voidlinux.org/current
#xbpsrepository="https://repo-default.voidlinux.org/current"
# pkgs: additional packages to install into the target
# default: none
......
......@@ -67,7 +67,8 @@ VAI_install_base_system() {
# Install additional packages
if [ -n "${pkgs}" ] ; then
XBPS_ARCH="${XBPS_ARCH}" xbps-install -Sy -R "${xbpsrepository}" -r /mnt "${pkgs}"
# shellcheck disable=SC2086
XBPS_ARCH="${XBPS_ARCH}" xbps-install -Sy -R "${xbpsrepository}" -r /mnt ${pkgs}
fi
}
......@@ -80,7 +81,8 @@ VAI_prepare_chroot() {
VAI_configure_sudo() {
# Give wheel sudo
echo "%wheel ALL=(ALL) ALL" > "${target}/etc/sudoers.d/wheel"
echo "%wheel ALL=(ALL:ALL) ALL" > "${target}/etc/sudoers.d/00-wheel"
chmod 0440 "${target}/etc/sudoers.d/00-wheel"
}
VAI_correct_root_permissions() {
......@@ -202,10 +204,10 @@ VAI_configure_autoinstall() {
XBPS_ARCH="$(xbps-uhelper arch)"
case $XBPS_ARCH in
*-musl)
xbpsrepository="https://alpha.de.repo.voidlinux.org/current/musl"
xbpsrepository="https://repo-default.voidlinux.org/current/musl"
;;
*)
xbpsrepository="https://alpha.de.repo.voidlinux.org/current"
xbpsrepository="https://repo-default.voidlinux.org/current"
;;
esac
......
......@@ -35,7 +35,7 @@ chroot ${NEWROOT} chsh --shell '/bin/bash' root >/dev/null
# Enable sudo permission by default.
if [ -f ${NEWROOT}/etc/sudoers ]; then
echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> ${NEWROOT}/etc/sudoers
echo "${USERNAME} ALL=(ALL:ALL) NOPASSWD: ALL" > "${NEWROOT}/etc/sudoers.d/99-void-live"
fi
if [ -d ${NEWROOT}/etc/polkit-1 ]; then
......
......@@ -28,5 +28,4 @@ install() {
inst_hook pre-pivot 02 "$moddir/getty-serial.sh"
inst_hook pre-pivot 03 "$moddir/locale.sh"
inst_hook pre-pivot 04 "$moddir/splitlinux.sh"
inst_hook pre-pivot 05 "$moddir/services.sh"
}
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
SERVICEDIR=$NEWROOT/etc/sv
SERVICES="$(getarg live.services)"
for f in ${SERVICES}; do
ln -sf /etc/sv/$f $NEWROOT/etc/runit/runsvdir/default/
done
dhcpcd=1
for f in connmand NetworkManager wicd; do
if [ -e $SERVICEDIR/$f ]; then
unset dhcpcd
fi
done
# Enable all services by default... with some exceptions.
for f in $SERVICEDIR/*; do
_service=${f##*/}
case "${_service}" in
sshd|agetty-console|agetty-generic|agetty-serial|agetty-tty[SAU]*|agetty-hv*|sulogin|dhcpcd-*|iptables|ip6tables|pulseaudio|lvmetad|dmeventd|mdadm) ;; # ignored
dhcpcd) [ -n "$dhcpcd" ] && ln -sf ${f##$NEWROOT} $NEWROOT/etc/runit/runsvdir/default/;;
*) ln -sf ${f##$NEWROOT} $NEWROOT/etc/runit/runsvdir/default/;;
esac
done
......@@ -108,11 +108,10 @@ else
lvm vgchange --activate y split &&
mount /dev/mapper/split-horde /sysroot/var/lib/lxc
#echo 'Swapping on "swap" logical volume of "split" volume group (if both exist).'
#uuid_of_swap_device=`lsblk --noheadings --list --output FSTYPE,NAME,UUID | sed --silent 's#^swap \+split-swap \+##p'`
# `swapon` is not available
# TODO see if the partition is used without any explicit command
#[ -z $uuid_of_swap_device ] || swapon -U ${uuid_of_swap_device}
echo 'Swapping on "swap" logical volume of "split" volume group (if both exist).'
uuid_of_swap_device=`lsblk --noheadings --list --output FSTYPE,NAME,UUID | sed --silent 's#^swap \+split-swap \+##p'`
[ -z $uuid_of_swap_device ] ||
echo "UUID=${uuid_of_swap_device} swap swap defaults,noatime,nofail 0 0" >> ${NEWROOT}/etc/fstab
fi
......@@ -136,7 +135,7 @@ else
fi
echo 'Populating host file system with contents from _host/override/etc/'
echo 'Populating host file system with contents from _host/override/etc/.'
cp -a ${NEWROOT}/var/lib/lxc/_host/override/etc/* ${NEWROOT}/etc/
......@@ -191,7 +190,7 @@ chroot ${NEWROOT} sh -c '
echo 'Adding profile.d script that forks host logins to container-logins.'
echo ' This is done by attaching the container and loading its .xinitrc, which will'
echo ' typically call a graphical application (ie. a window manager).'
echo ' typically call a graphical application (i.e. a window manager).'
if [ -x ${NEWROOT}/sbin/lxc-info ]; then
echo 'if [ -z $DISPLAY ] ; then
if groups "${USER}" | grep --quiet --fixed-strings --word-regexp lxc ; then
......
......@@ -25,11 +25,15 @@ if loadfont "(${voidlive})/boot/grub/fonts/unicode.pf2" ; then
fi
if [ cpuid -l ]; then
# Kernel arguments configured here should be equal to those in
# isolinux/isolinux.cfg.in.
menuentry "@@BOOT_TITLE@@ @@KERNVER@@ (@@ARCH@@)" {
set gfxpayload="keep"
linux (${voidlive})/boot/vmlinuz \
root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \
rd.auto=1 rd.luks=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \
rd.auto=1 hugepagesz=1G hugepages=0 \
rd.luks=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \
vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \
locale.LANG=@@LOCALE@@ @@BOOT_CMDLINE@@
initrd (${voidlive})/boot/initrd
......@@ -38,7 +42,8 @@ if [ cpuid -l ]; then
set gfxpayload="keep"
linux (${voidlive})/boot/vmlinuz \
root=live:CDLABEL=VOID_LIVE ro init=/sbin/init \
rd.auto=1 rd.luks=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \
rd.auto=1 hugepagesz=1G hugepages=0 \
rd.luks=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \
vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ \
locale.LANG=@@LOCALE@@ @@BOOT_CMDLINE@@ rd.live.ram
initrd (${voidlive})/boot/initrd
......
......@@ -606,7 +606,7 @@ menu_timezone() {
set_timezone() {
local TIMEZONE="$(get_option TIMEZONE)"
sed -i -e "s|#TIMEZONE=.*|TIMEZONE=$TIMEZONE|g" $TARGETDIR/etc/rc.conf
ln -sf "/usr/share/zoneinfo/${TIMEZONE}" "${TARGETDIR}/etc/localtime"
}
menu_hostname() {
......@@ -665,16 +665,24 @@ set_rootpassword() {
menu_useraccount() {
local _firstpass _secondpass _desc _again
local _groups _status _group _checklist
local _preset
local _preset _userlogin
while true; do
_preset=$(get_option USERLOGIN)
[ -z "$_preset" ] && _preset="void"
DIALOG --inputbox "Enter a primary login name:" ${INPUTSIZE} "$_preset"
if [ $? -eq 0 ]; then
set_option USERLOGIN "$(cat $ANSWER)"
USERLOGIN_DONE=1
break
_userlogin="$(cat $ANSWER)"
# based on useradd(8) § Caveats
if [ "${#_userlogin}" -le 32 ] && [[ "${_userlogin}" =~ ^[a-z_][a-z0-9_-]*[$]?$ ]]; then
set_option USERLOGIN "${_userlogin}"
USERLOGIN_DONE=1
break
else
INFOBOX "Invalid login name! Please try again." 6 60
unset _userlogin
sleep 2 && clear && continue
fi
else
return
fi
......@@ -814,14 +822,18 @@ set_bootloader() {
}
test_network() {
rm -f xtraeme.asc && \
xbps-uhelper fetch http://alpha.de.repo.voidlinux.org/live/xtraeme.asc >$LOG 2>&1
rm -f otime && \
xbps-uhelper fetch https://repo-default.voidlinux.org/current/otime >$LOG 2>&1
if [ $? -eq 0 ]; then
DIALOG --msgbox "Network is working properly!" ${MSGBOXSIZE}
NETWORK_DONE=1
return 1
fi
DIALOG --msgbox "Network is inaccessible, please set it up properly." ${MSGBOXSIZE}
if [ "$1" = "nm" ]; then
DIALOG --msgbox "Network Manager is enabled but network is inaccessible, please set it up externally with nmcli, nmtui, or the Network Manager tray applet." ${MSGBOXSIZE}
else
DIALOG --msgbox "Network is inaccessible, please set it up properly." ${MSGBOXSIZE}
fi
}
configure_wifi() {
......@@ -831,8 +843,8 @@ configure_wifi() {
"SSID:" 1 1 "" 1 16 30 0 \
"Encryption:" 2 1 "" 2 16 4 3 \
"Password:" 3 1 "" 3 16 63 0 || return 1
set -- $(cat $ANSWER)
ssid="$1"; enc="$2"; pass="$3";
readarray -t values <<<$(cat $ANSWER)
ssid="${values[0]}"; enc="${values[1]}"; pass="${values[2]}"
if [ -z "$ssid" ]; then
DIALOG --msgbox "Invalid SSID." ${MSGBOXSIZE}
......@@ -844,19 +856,27 @@ configure_wifi() {
DIALOG --msgbox "Invalid AP password." ${MSGBOXSIZE}
fi
rm -f ${_wpasupconf%.conf}-${dev}.conf
cp -f ${_wpasupconf} ${_wpasupconf%.conf}-${dev}.conf
# reset the configuration to the default, if necessary
# otherwise backup the configuration
if [ -f ${_wpasupconf}.orig ]; then
cp -f ${_wpasupconf}.orig ${_wpasupconf}
else
cp -f ${_wpasupconf} ${_wpasupconf}.orig
fi
if [ "$enc" = "wep" ]; then
echo "network={" >> ${_wpasupconf%.conf}-${dev}.conf
echo " ssid=\"$ssid\"" >> ${_wpasupconf%.conf}-${dev}.conf
echo " wep_key0=\"$pass\"" >> ${_wpasupconf%.conf}-${dev}.conf
echo " wep_tx_keyidx=0" >> ${_wpasupconf%.conf}-${dev}.conf
echo " auth_alg=SHARED" >> ${_wpasupconf%.conf}-${dev}.conf
echo "}" >> ${_wpasupconf%.conf}-${dev}.conf
cat << EOF >> ${_wpasupconf}
network={
ssid="$ssid"
wep_key0="$pass"
wep_tx_keyidx=0
auth_alg=SHARED
}
EOF
else
wpa_passphrase "$ssid" "$pass" >> ${_wpasupconf%.conf}-${dev}.conf
wpa_passphrase "$ssid" "$pass" >> ${_wpasupconf}
fi
sv restart wpa_supplicant
configure_net_dhcp $dev
return $?
}
......@@ -874,7 +894,7 @@ configure_net() {
}
iface_setup() {
ip addr show dev $1|grep -q 'inet '
ip addr show dev $1 | grep -q -e 'inet ' -e 'inet6 '
return $?
}
......@@ -883,13 +903,14 @@ configure_net_dhcp() {
iface_setup $dev
if [ $? -eq 1 ]; then
dhcpcd -t 10 -w -4 -L $dev -e "wpa_supplicant_conf=/etc/wpa_supplicant/wpa_supplicant-${dev}.conf" 2>&1 | tee $LOG | \
sv restart dhcpcd 2>&1 | tee $LOG | \
DIALOG --progressbox "Initializing $dev via DHCP..." ${WIDGET_SIZE}
if [ $? -ne 0 ]; then
DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} failed to run dhcpcd. See $LOG for details." ${MSGBOXSIZE}
return 1
fi
iface_setup $dev
export -f iface_setup
timeout 10s bash -c "while true; do iface_setup $dev; sleep 0.25; done"
if [ $? -eq 1 ]; then
DIALOG --msgbox "${BOLD}${RED}ERROR:${RESET} DHCP request failed for $dev. Check $LOG for errors." ${MSGBOXSIZE}
return 1
......@@ -940,6 +961,11 @@ configure_net_static() {
menu_network() {
local dev addr f DEVICES
if [ -e /var/service/NetworkManager ]; then
test_network nm
return
fi
for f in $(ls /sys/class/net); do
[ "$f" = "lo" ] && continue
addr=$(cat /sys/class/net/$f/address)
......@@ -1031,7 +1057,7 @@ failed to activate swap on $dev!\ncheck $LOG for errors." ${MSGBOXSIZE}
fi
# Add entry for target fstab
uuid=$(blkid -o value -s UUID "$dev")
echo "UUID=$uuid none swap sw 0 0" >>$TARGET_FSTAB
echo "UUID=$uuid none swap defaults 0 0" >>$TARGET_FSTAB
continue
fi
......@@ -1067,7 +1093,7 @@ failed to mount $dev on ${mntpt}! check $LOG for errors." ${MSGBOXSIZE}
fi
# Add entry to target fstab
uuid=$(blkid -o value -s UUID "$dev")
if [ "$fstype" = "f2fs" ]; then
if [ "$fstype" = "f2fs" -o "$fstype" = "btrfs" -o "$fstype" = "xfs" ]; then
fspassno=0
else
fspassno=1
......@@ -1092,7 +1118,12 @@ failed to mount $dev on $mntpt! check $LOG for errors." ${MSGBOXSIZE}
fi
# Add entry to target fstab
uuid=$(blkid -o value -s UUID "$dev")
echo "UUID=$uuid $mntpt $fstype defaults 0 2" >>$TARGET_FSTAB
if [ "$fstype" = "f2fs" -o "$fstype" = "btrfs" -o "$fstype" = "xfs" ]; then
fspassno=0
else
fspassno=2
fi
echo "UUID=$uuid $mntpt $fstype defaults 0 $fspassno" >>$TARGET_FSTAB
done
}
......@@ -1246,7 +1277,7 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return
# Remove live user.
echo "Removing $USERNAME live user from targetdir ..." >$LOG
chroot $TARGETDIR userdel -r $USERNAME >$LOG 2>&1
sed -i -e "/$USERNAME ALL=.*/d" $TARGETDIR/etc/sudoers
rm -f $TARGETDIR/etc/sudoers.d/99-void-live
TITLE="Check $LOG for details ..."
INFOBOX "Rebuilding initramfs for target ..." 4 60
echo "Rebuilding initramfs for target ..." >$LOG
......@@ -1255,7 +1286,7 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return
chroot $TARGETDIR dracut --no-hostonly --add-drivers "ahci" --force >>$LOG 2>&1
INFOBOX "Removing temporary packages from target ..." 4 60
echo "Removing temporary packages from target ..." >$LOG
xbps-remove -r $TARGETDIR -Ry dialog >>$LOG 2>&1
xbps-remove -r $TARGETDIR -Ry dialog xtools-minimal >>$LOG 2>&1
rmdir $TARGETDIR/mnt/target
else
# mount required fs
......@@ -1292,15 +1323,14 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return
# network type empty??!!!
:
elif [ "$_type" = "dhcp" ]; then
if [ -f /etc/wpa_supplicant/wpa_supplicant-${_dev}.conf ]; then
cp /etc/wpa_supplicant/wpa_supplicant-${_dev}.conf $TARGETDIR/etc/wpa_supplicant
ln -sf /etc/sv/dhcpcd-${_dev} $TARGETDIR/etc/runit/runsvdir/default/dhcpcd-${_dev}
else
enable_dhcpd
if $(echo $_dev|egrep -q "^wl.*" 2>/dev/null); then
cp /etc/wpa_supplicant/wpa_supplicant.conf $TARGETDIR/etc/wpa_supplicant
ln -sf /etc/sv/wpa_supplicant $TARGETDIR/etc/runit/runsvdir/default/wpa_supplicant
fi
enable_dhcpd
elif [ -n "$_dev" -a "$_type" = "static" ]; then
# static IP through dhcpcd.
mv $TARGETDIR/etc/dhcpcd.conf $TARGETDIR/etc/dhdpcd.conf.orig
mv $TARGETDIR/etc/dhcpcd.conf $TARGETDIR/etc/dhcpcd.conf.orig
echo "# Static IP configuration set by the void-installer for $_dev." \
>$TARGETDIR/etc/dhcpcd.conf
echo "interface $_dev" >>$TARGETDIR/etc/dhcpcd.conf
......@@ -1311,16 +1341,15 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return
fi
fi
if [ -f $TARGETDIR/etc/sudoers ]; then
if [ -d $TARGETDIR/etc/sudoers.d ]; then
USERLOGIN="$(get_option USERLOGIN)"
if [ -z "$(echo $(get_option USERGROUPS) | grep -w wheel)" -a -n "$USERLOGIN" ]; then
# enable sudo for primary user USERLOGIN who is not member of wheel
echo "# Enable sudo for login '$USERLOGIN'" >> $TARGETDIR/etc/sudoers
echo "$USERLOGIN ALL=(ALL) ALL" >> $TARGETDIR/etc/sudoers
echo "# Enable sudo for login '$USERLOGIN'" > "$TARGETDIR/etc/sudoers.d/$USERLOGIN"
echo "$USERLOGIN ALL=(ALL:ALL) ALL" >> "$TARGETDIR/etc/sudoers.d/$USERLOGIN"
else
# enable the sudoers entry for members of group wheel
sed -i $TARGETDIR/etc/sudoers \
-e "s;#.*%wheel ALL=(ALL) ALL;%wheel ALL=(ALL) ALL;"
echo "%wheel ALL=(ALL:ALL) ALL" > "$TARGETDIR/etc/sudoers.d/wheel"
fi
unset USERLOGIN
fi
......
......@@ -20,14 +20,17 @@ MENU COLOR title * #FF5255FF *
MENU COLOR border * #00000000 #00000000 none
MENU COLOR sel * #ffffffff #FF5255FF *
# Kernel arguments configured here should be equal to those in
# grub/grub_void.cfg.in.
LABEL linux
MENU LABEL @@BOOT_TITLE@@ @@KERNVER@@ @@ARCH@@
KERNEL /boot/vmlinuz
APPEND initrd=/boot/initrd root=live:CDLABEL=VOID_LIVE init=/sbin/init ro rd.auto=1 rd.luks=0 rd.dm=0 loglevel=4 vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ locale.LANG=@@LOCALE@@ @@BOOT_CMDLINE@@
APPEND initrd=/boot/initrd root=live:CDLABEL=VOID_LIVE init=/sbin/init ro rd.auto=1 hugepagesz=1G hugepages=0 rd.luks=0 rd.dm=0 loglevel=4 vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ locale.LANG=@@LOCALE@@ @@BOOT_CMDLINE@@
LABEL linuxram
MENU LABEL @@BOOT_TITLE@@ @@KERNVER@@ @@ARCH@@ (RAM)
KERNEL /boot/vmlinuz
APPEND initrd=/boot/initrd root=live:CDLABEL=VOID_LIVE init=/sbin/init ro rd.auto=1 rd.luks=0 rd.dm=0 loglevel=4 vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ locale.LANG=@@LOCALE@@ @@BOOT_CMDLINE@@ rd.live.ram
APPEND initrd=/boot/initrd root=live:CDLABEL=VOID_LIVE init=/sbin/init ro rd.auto=1 hugepagesz=1G hugepages=0 rd.luks=0 rd.dm=0 loglevel=4 vconsole.unicode=1 vconsole.keymap=@@KEYMAP@@ locale.LANG=@@LOCALE@@ @@BOOT_CMDLINE@@ rd.live.ram
LABEL c
MENU LABEL Boot first HD found by BIOS
COM32 chain.c32
......
......@@ -82,7 +82,7 @@ mount_pseudofs() {
# pseudofs isn't already mounted. If it already is then
# this is virtually impossible to troubleshoot because it
# looks like the subsequent umount just isn't working.
mount -r --rbind /$f "$ROOTFS/$f"
mount -r --rbind /$f "$ROOTFS/$f" --make-rslave
fi
done
if ! mountpoint -q "$ROOTFS/tmp" ; then
......@@ -287,10 +287,9 @@ set_target_arch_from_platform() {
cubieboard2*|cubietruck*) XBPS_TARGET_ARCH="armv7l";;
odroid-u2*) XBPS_TARGET_ARCH="armv7l";;
odroid-c2*) XBPS_TARGET_ARCH="aarch64";;
rpi4*) XBPS_TARGET_ARCH="aarch64";;
rpi3*) XBPS_TARGET_ARCH="aarch64";;
rpi2*) XBPS_TARGET_ARCH="armv7l";;
rpi*) XBPS_TARGET_ARCH="armv6l";;
rpi-aarch64*) XBPS_TARGET_ARCH="aarch64";;
rpi-armv7l*) XBPS_TARGET_ARCH="armv7l";;
rpi-armv6l*) XBPS_TARGET_ARCH="armv6l";;
ci20*) XBPS_TARGET_ARCH="mipsel";;
i686*) XBPS_TARGET_ARCH="i686";;
x86_64*) XBPS_TARGET_ARCH="x86_64";;
......@@ -329,9 +328,9 @@ rk33xx_flash_uboot() {
# These should all resolve even if they won't have the appropriate
# repodata files for the selected architecture.
: "${XBPS_REPOSITORY:=--repository=http://alpha.de.repo.voidlinux.org/current \
--repository=http://alpha.de.repo.voidlinux.org/current/musl \
--repository=http://alpha.de.repo.voidlinux.org/current/aarch64}"
: "${XBPS_REPOSITORY:=--repository=https://repo-default.voidlinux.org/current \
--repository=https://repo-default.voidlinux.org/current/musl \
--repository=https://repo-default.voidlinux.org/current/aarch64}"
......
......@@ -117,7 +117,7 @@ PLATFORM="${PLATFORM%-PLATFORMFS*}"
# Be absolutely certain the platform is supported before continuing
case "$PLATFORM" in
bananapi|beaglebone|cubieboard2|cubietruck|odroid-c2|odroid-u2|rpi|rpi2|rpi3|rpi4|GCP|pinebookpro|pinephone|rock64|*-musl);;
bananapi|beaglebone|cubieboard2|cubietruck|odroid-c2|odroid-u2|rpi-armv6l|rpi-armv7l|rpi-aarch64|GCP|pinebookpro|pinephone|rock64|*-musl);;
*) die "The $PLATFORM is not supported, exiting..."
esac
......@@ -196,7 +196,7 @@ _EOF
label: gpt
unit: sectors
first-lba: 32768
name=BootFS, size=${BOOT_FSSIZE}, type=L, bootable
name=BootFS, size=${BOOT_FSSIZE}, type=L, bootable, attrs="LegacyBIOSBootable"
name=RootFS, type=L
_EOF
;;
......
......@@ -78,6 +78,7 @@ directory if unset).
-o <file> Output file name for the ISO image (auto if unset).
-p "pkg pkgN ..." Install additional packages into the ISO image.
-I <includedir> Include directory structure under given path into rootfs
-S "service serviceN ..." Services to enable
-C "cmdline args" Add additional kernel command line arguments.
-T "title" Modify the bootloader title.
......@@ -140,6 +141,16 @@ install_packages() {
rm -rf "$ROOTFS"/var/cache/* "$ROOTFS"/run/* "$ROOTFS"/var/run/*
}
enable_services() {
SERVICE_LIST="$*"
for service in $SERVICE_LIST; do
if ! [ -e $ROOTFS/etc/sv/$service ]; then
die "service $service not in /etc/sv"
fi
ln -sf /etc/sv/$service $ROOTFS/etc/runit/runsvdir/default/
done
}
copy_include_directory() {
find "$INCLUDE_DIRECTORY" -mindepth 1 -maxdepth 1 -exec cp -rfpPv {} "$ROOTFS"/ \;
}
......@@ -282,7 +293,7 @@ generate_iso_image() {
#
# main()
#
while getopts "a:b:r:c:C:T:Kk:l:i:I:s:o:p:v:h" opt; do
while getopts "a:b:r:c:C:T:Kk:l:i:I:S:s:o:p:v:h" opt; do
case $opt in
a) BASE_ARCH="$OPTARG";;
b) BASE_SYSTEM_PKG="$OPTARG";;
......@@ -293,6 +304,7 @@ while getopts "a:b:r:c:C:T:Kk:l:i:I:s:o:p:v:h" opt; do
l) LOCALE="$OPTARG";;
i) INITRAMFS_COMPRESSION="$OPTARG";;
I) INCLUDE_DIRECTORY="$OPTARG";;
S) SERVICE_LIST="$OPTARG";;
s) SQUASHFS_COMPRESSION="$OPTARG";;
o) OUTPUT_FILE="$OPTARG";;
p) PACKAGE_LIST="$OPTARG";;
......@@ -304,7 +316,7 @@ while getopts "a:b:r:c:C:T:Kk:l:i:I:s:o:p:v:h" opt; do
esac
done
shift $((OPTIND - 1))
XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=http://alpha.de.repo.voidlinux.org/current --repository=http://alpha.de.repo.voidlinux.org/current/musl"
XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=https://repo-default.voidlinux.org/current --repository=https://repo-default.voidlinux.org/current/musl"
# Configure dracut to use overlayfs for the writable overlay.
BOOT_CMDLINE="$BOOT_CMDLINE rd.live.overlay.overlayfs=1 "
......@@ -374,7 +386,7 @@ if [ -n "$LINUX_VERSION" ]; then
_linux_series="$LINUX_VERSION"
PACKAGE_LIST="$PACKAGE_LIST $LINUX_VERSION"
else # Otherwise find latest stable version from linux meta-package
_linux_series=$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -x linux|head -1)
_linux_series=$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -x linux | grep 'linux[0-9._]\+')
fi
_kver=$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -p pkgver ${_linux_series})
......@@ -396,6 +408,10 @@ mkdir -p "$ROOTFS"/etc
print_step "Installing void pkgs into the rootfs: ${PACKAGE_LIST} ..."
install_packages
: ${DEFAULT_SERVICE_LIST:=agetty-tty1 agetty-tty2 agetty-tty3 agetty-tty4 agetty-tty5 agetty-tty6 udevd}
print_step "Enabling services: ${SERVICE_LIST} ..."
enable_services ${DEFAULT_SERVICE_LIST} ${SERVICE_LIST}
if [ -n "${INCLUDE_DIRECTORY}" ];then
print_step "Copying directory structure into the rootfs: ${INCLUDE_DIRECTORY} ..."
copy_include_directory
......
......@@ -50,7 +50,7 @@ Usage: $PROGNAME [options] <platform> <base-tarball>
Supported platforms: i686, x86_64, GCP, bananapi, beaglebone,
cubieboard2, cubietruck, odroid-c2, odroid-u2,
rpi, rpi2 (armv7), rpi3 (aarch64), rpi4 (aarch64), ci20,
rpi-armv6l, rpi-armv7l, rpi-aarch64, ci20,
pinebookpro, pinephone, rock64
Options
......@@ -117,9 +117,6 @@ case "$PLATFORM" in
cubieboard2*|cubietruck*) PKGS="$BASEPKG ${PLATFORM%-*}-base" ;;
odroid-u2*) PKGS="$BASEPKG ${PLATFORM%-*}-base" ;;
odroid-c2*) PKGS="$BASEPKG ${PLATFORM%-musl}-base" ;;
rpi4*) PKGS="$BASEPKG rpi4-base" ;;
rpi3*) PKGS="$BASEPKG rpi3-base" ;;
rpi2*) PKGS="$BASEPKG rpi2-base" ;;
rpi*) PKGS="$BASEPKG rpi-base" ;;
ci20*) PKGS="$BASEPKG ${PLATFORM%-*}-base" ;;
i686*) PKGS="$BASEPKG" ;;
......@@ -216,7 +213,7 @@ rm -rf "$ROOTFS/var/cache/*" 2>/dev/null
# Now we can run the POST_CMD script. This user-supplied script gets the
# $ROOTFS as a parameter.
if [ -n "$POST_CMD" ]; then
info_msg "Running user supllied command: $POST_CMD"
info_msg "Running user supplied command: $POST_CMD"
run_cmd $POST_CMD $ROOTFS
fi
......@@ -227,6 +224,7 @@ if [ "$COMPRESSION" = "y" ]; then
# platform and the date on which the tarball was built.
tarball=${FILENAME:-void-${PLATFORM}-PLATFORMFS-$(date '+%Y%m%d').tar.xz}
run_cmd "tar -cp --posix --xattrs -C $ROOTFS . | xz -T${COMPRESSOR_THREADS:-0} -9 > $tarball "
[ $? -ne 0 ] && die "Failed to compress tarball"
# Now that we have the tarball we don't need the rootfs anymore, so we
# can get rid of it.
......
......@@ -6,7 +6,7 @@ source "qemu" "x86_64" {
format = "qcow2"
http_directory = "http"
iso_checksum = "sha256:d95d40e1eb13a7776b5319a05660792fddd762662eaecee5df6b8feb3aa9b391"
iso_url = "https://alpha.de.repo.voidlinux.org/live/20200722/void-live-x86_64-5.7.10_1-20200722.iso"
iso_url = "https://repo-default.voidlinux.org/live/20200722/void-live-x86_64-5.7.10_1-20200722.iso"
ssh_password = "void"
ssh_timeout = "20m"
ssh_username = "void"
......