Merge branch 'master' of https://github.com/void-linux/void-mklive
This commit is contained in:
commit
d19dec5f71
2
Makefile
2
Makefile
@ -27,7 +27,7 @@ ALL_PXE_ARCHS=$(foreach arch,$(PXE_ARCHS),void-$(arch)-NETBOOT-$(DATE).tar.gz)
|
||||
|
||||
SUDO := sudo
|
||||
|
||||
XBPS_REPOSITORY := -r https://repo.voidlinux.eu/current -r https://repo.voidlinux.eu/current/musl -r https://repo.voidlinux.eu/current/aarch64
|
||||
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
|
||||
COMPRESSOR_THREADS=2
|
||||
|
||||
%.sh: %.sh.in
|
||||
|
@ -28,12 +28,12 @@ readonly LXQT_IMG=void-live-${ARCH}-${DATE}-lxqt.iso
|
||||
readonly GRUB="grub-i386-efi grub-x86_64-efi"
|
||||
|
||||
readonly BASE_PKGS="dialog cryptsetup lvm2 mdadm $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 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 intel-ucode"
|
||||
readonly E_PKGS="$X_PKGS lxdm enlightenment terminology econnman 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 KDE_PKGS="$X_PKGS kde"
|
||||
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"
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
# XBPS Configuration
|
||||
# ===
|
||||
# xbpsrepository: which repo should the install pull from
|
||||
# default: http://repo.voidlinux.eu/current
|
||||
#xbpsrepository="http://repo.voidlinux.eu/current"
|
||||
# default: http://alpha.de.repo.voidlinux.org/current
|
||||
#xbpsrepository="http://alpha.de.repo.voidlinux.org/current"
|
||||
|
||||
# pkgs: additional packages to install into the target
|
||||
# default: none
|
||||
|
@ -201,10 +201,10 @@ VAI_configure_autoinstall() {
|
||||
XBPS_ARCH="$(xbps-uhelper arch)"
|
||||
case $XBPS_ARCH in
|
||||
*-musl)
|
||||
xbpsrepository="https://repo.voidlinux.eu/current/musl"
|
||||
xbpsrepository="https://alpha.de.repo.voidlinux.org/current/musl"
|
||||
;;
|
||||
*)
|
||||
xbpsrepository="https://repo.voidlinux.eu/current"
|
||||
xbpsrepository="https://alpha.de.repo.voidlinux.org/current"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -21,10 +21,14 @@ if [ -d ${NEWROOT}/etc/gdm ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Configure KDM autologin
|
||||
if [ -e ${NEWROOT}/etc/kdm/kdmrc ]; then
|
||||
sed -i -e "s|^\#\(AutoLoginEnable=\).*|\1|" ${NEWROOT}/etc/kdm/kdmrc
|
||||
sed -i -e "s|^\#\(AutoLoginUser=\).*|\1$USERNAME|" ${NEWROOT}/etc/kdm/kdmrc
|
||||
# Configure sddm autologin for the kde iso.
|
||||
if [ -r ${NEWROOT}/etc/sddm.conf ]; then
|
||||
mv ${NEWROOT}/etc/sddm.conf ${NEWROOT}/etc/sddm.conf.old
|
||||
cat > ${NEWROOT}/etc/sddm.conf <<_EOF
|
||||
[Autologin]
|
||||
User=anon
|
||||
Session=plasma.desktop
|
||||
_EOF
|
||||
fi
|
||||
|
||||
# Configure lightdm autologin.
|
||||
@ -52,5 +56,7 @@ if [ -r ${NEWROOT}/etc/lxdm/lxdm.conf ]; then
|
||||
sed -e "s,.*session.*=.*,session=/usr/bin/startlxde," -i ${NEWROOT}/etc/lxdm/lxdm.conf
|
||||
elif [ -x ${NEWROOT}/usr/bin/startlxqt ]; then
|
||||
sed -e "s,.*session.*=.*,session=/usr/bin/startlxqt," -i ${NEWROOT}/etc/lxdm/lxdm.conf
|
||||
elif [ -x ${NEWROOT}/usr/bin/startfluxbox ]; then
|
||||
sed -e "s,.*session.*=.*,session=/usr/bin/startfluxbox," -i ${NEWROOT}/etc/lxdm/lxdm.conf
|
||||
fi
|
||||
fi
|
||||
|
@ -379,6 +379,18 @@ show_partitions() {
|
||||
fi
|
||||
done
|
||||
done
|
||||
# Device Mapper
|
||||
for p in /dev/mapper/*; do
|
||||
part=$(basename $p)
|
||||
[ "${part}" = "live-rw" ] && continue
|
||||
[ "${part}" = "live-base" ] && continue
|
||||
[ "${part}" = "control" ] && continue
|
||||
|
||||
fstype=$(lsblk -nfr $p|awk '{print $2}'|head -1)
|
||||
fssize=$(lsblk -nr $p|awk '{print $4}'|head -1)
|
||||
echo "${p}"
|
||||
echo "size:${fssize:-unknown};fstype:${fstype:-none}"
|
||||
done
|
||||
# Software raid (md)
|
||||
for p in $(ls -d /dev/md* 2>/dev/null|grep '[0-9]'); do
|
||||
part=$(basename $p)
|
||||
@ -482,7 +494,7 @@ ${BOLD}NOTE: you don't need this on EFI systems.${RESET}\n\n
|
||||
For EFI systems GPT is mandatory and a FAT32 partition with at least\n
|
||||
100MB must be created with the TOGGLE \`boot', this will be used as\n
|
||||
EFI System Partition. This partition must have mountpoint as \`/boot/efi'.\n\n
|
||||
At least 1 partitions is required for the rootfs (/).\n
|
||||
At least 1 partition is required for the rootfs (/).\n
|
||||
For swap, RAM*2 must be really enough. For / 600MB are required.\n\n
|
||||
${BOLD}WARNING: /usr is not supported as a separate partition.${RESET}\n
|
||||
${RESET}\n" 18 80
|
||||
@ -795,7 +807,7 @@ set_bootloader() {
|
||||
|
||||
test_network() {
|
||||
rm -f xtraeme.asc && \
|
||||
xbps-uhelper fetch http://repo.voidlinux.eu/live/xtraeme.asc >$LOG 2>&1
|
||||
xbps-uhelper fetch http://alpha.de.repo.voidlinux.org/live/xtraeme.asc >$LOG 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
DIALOG --msgbox "Network is working properly!" ${MSGBOXSIZE}
|
||||
NETWORK_DONE=1
|
||||
@ -945,6 +957,7 @@ validate_filesystems() {
|
||||
mnts=$(grep -E '^MOUNTPOINT.*' $CONF_FILE)
|
||||
set -- ${mnts}
|
||||
while [ $# -ne 0 ]; do
|
||||
fmt=""
|
||||
dev=$2; fstype=$3; size=$4; mntpt="$5"; mkfs=$6
|
||||
shift 6
|
||||
|
||||
@ -1215,6 +1228,8 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return
|
||||
rm -f $TARGETDIR/etc/motd
|
||||
rm -f $TARGETDIR/etc/issue
|
||||
rm -f $TARGETDIR/usr/sbin/void-installer
|
||||
# Remove modified sddm.conf to let sddm use the defaults.
|
||||
rm -f $TARGETDIR/etc/sddm.conf
|
||||
# Remove live user.
|
||||
echo "Removing $USERNAME live user from targetdir ..." >$LOG
|
||||
chroot $TARGETDIR userdel -r $USERNAME >$LOG 2>&1
|
||||
@ -1284,15 +1299,17 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return
|
||||
fi
|
||||
|
||||
if [ -f $TARGETDIR/etc/sudoers ]; then
|
||||
if [ -z "$(echo $(get_option USERGROUPS) | grep -w wheel)" ]; then
|
||||
# enable sudo for primary user USERLOGIN
|
||||
echo "# Enable sudo for login '$(get_option USERLOGIN)'" >> $TARGETDIR/etc/sudoers
|
||||
echo "$(get_option USERLOGIN) ALL=(ALL) ALL" >> $TARGETDIR/etc/sudoers
|
||||
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
|
||||
else
|
||||
# enable sudoers entry for members of group wheel for primary user
|
||||
# enable the sudoers entry for members of group wheel
|
||||
sed -i $TARGETDIR/etc/sudoers \
|
||||
-e "s;#.*%wheel ALL=(ALL) ALL;%wheel ALL=(ALL) ALL;"
|
||||
fi
|
||||
unset USERLOGIN
|
||||
fi
|
||||
|
||||
# enable text console for grub if chosen
|
||||
@ -1343,23 +1360,42 @@ menu() {
|
||||
DEFITEM="Keyboard"
|
||||
fi
|
||||
|
||||
DIALOG --default-item $DEFITEM \
|
||||
--extra-button --extra-label "Settings" \
|
||||
--title " Void Linux installation menu " \
|
||||
--menu "$MENULABEL" 10 70 0 \
|
||||
"Keyboard" "Set system keyboard" \
|
||||
"Network" "Set up the network" \
|
||||
"Source" "Set source installation" \
|
||||
"Hostname" "Set system hostname" \
|
||||
"Locale" "Set system locale" \
|
||||
"Timezone" "Set system time zone" \
|
||||
"RootPassword" "Set system root password" \
|
||||
"UserAccount" "Set primary user name and password" \
|
||||
"BootLoader" "Set disk to install bootloader" \
|
||||
"Partition" "Partition disk(s)" \
|
||||
"Filesystems" "Configure filesystems and mount points" \
|
||||
"Install" "Start installation with saved settings" \
|
||||
"Exit" "Exit installation"
|
||||
if xbps-uhelper arch | grep '-musl$' > /dev/null; then
|
||||
DIALOG --default-item $DEFITEM \
|
||||
--extra-button --extra-label "Settings" \
|
||||
--title " Void Linux installation menu " \
|
||||
--menu "$MENULABEL" 10 70 0 \
|
||||
"Keyboard" "Set system keyboard" \
|
||||
"Network" "Set up the network" \
|
||||
"Source" "Set source installation" \
|
||||
"Hostname" "Set system hostname" \
|
||||
"Timezone" "Set system time zone" \
|
||||
"RootPassword" "Set system root password" \
|
||||
"UserAccount" "Set primary user name and password" \
|
||||
"BootLoader" "Set disk to install bootloader" \
|
||||
"Partition" "Partition disk(s)" \
|
||||
"Filesystems" "Configure filesystems and mount points" \
|
||||
"Install" "Start installation with saved settings" \
|
||||
"Exit" "Exit installation"
|
||||
else
|
||||
DIALOG --default-item $DEFITEM \
|
||||
--extra-button --extra-label "Settings" \
|
||||
--title " Void Linux installation menu " \
|
||||
--menu "$MENULABEL" 10 70 0 \
|
||||
"Keyboard" "Set system keyboard" \
|
||||
"Network" "Set up the network" \
|
||||
"Source" "Set source installation" \
|
||||
"Hostname" "Set system hostname" \
|
||||
"Locale" "Set system locale" \
|
||||
"Timezone" "Set system time zone" \
|
||||
"RootPassword" "Set system root password" \
|
||||
"UserAccount" "Set primary user name and password" \
|
||||
"BootLoader" "Set disk to install bootloader" \
|
||||
"Partition" "Partition disk(s)" \
|
||||
"Filesystems" "Configure filesystems and mount points" \
|
||||
"Install" "Start installation with saved settings" \
|
||||
"Exit" "Exit installation"
|
||||
fi
|
||||
|
||||
if [ $? -eq 3 ]; then
|
||||
# Show settings
|
||||
|
12
lib.sh.in
12
lib.sh.in
@ -173,6 +173,12 @@ register_binfmt() {
|
||||
_mask="\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff"
|
||||
QEMU_BIN=qemu-aarch64-static
|
||||
;;
|
||||
ppc*)
|
||||
_cpu=ppc
|
||||
_magic="\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14"
|
||||
_mask="\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff"
|
||||
QEMU_BIN=qemu-ppc-static
|
||||
;;
|
||||
mipsel*)
|
||||
_cpu=mipsel
|
||||
_magic="\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00"
|
||||
@ -270,9 +276,9 @@ set_cachedir() {
|
||||
|
||||
# These should all resolve even if they won't have the appropriate
|
||||
# repodata files for the selected architecture.
|
||||
: "${XBPS_REPOSITORY:=--repository=http://repo.voidlinux.eu/current \
|
||||
--repository=http://repo.voidlinux.eu/current/musl \
|
||||
--repository=http://repo.voidlinux.eu/current/aarch64}"
|
||||
: "${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}"
|
||||
|
||||
|
||||
|
||||
|
181
mklive.sh.in
181
mklive.sh.in
@ -31,7 +31,7 @@ umask 022
|
||||
|
||||
readonly REQUIRED_PKGS="base-files libgcc dash coreutils sed tar gawk syslinux grub-i386-efi grub-x86_64-efi squashfs-tools xorriso"
|
||||
readonly INITRAMFS_PKGS="binutils xz device-mapper dhclient dracut-network"
|
||||
readonly PROGNAME=$(basename $0)
|
||||
readonly PROGNAME=$(basename "$0")
|
||||
|
||||
info_msg() {
|
||||
printf "\033[1m$@\n\033[m"
|
||||
@ -46,19 +46,19 @@ print_step() {
|
||||
}
|
||||
mount_pseudofs() {
|
||||
for f in sys dev proc; do
|
||||
mkdir -p $ROOTFS/$f
|
||||
mount --bind /$f $ROOTFS/$f
|
||||
mkdir -p "$ROOTFS"/$f
|
||||
mount --bind /$f "$ROOTFS"/$f
|
||||
done
|
||||
}
|
||||
umount_pseudofs() {
|
||||
umount -f $ROOTFS/sys >/dev/null 2>&1
|
||||
umount -f $ROOTFS/dev >/dev/null 2>&1
|
||||
umount -f $ROOTFS/proc >/dev/null 2>&1
|
||||
umount -f "$ROOTFS"/sys >/dev/null 2>&1
|
||||
umount -f "$ROOTFS"/dev >/dev/null 2>&1
|
||||
umount -f "$ROOTFS"/proc >/dev/null 2>&1
|
||||
}
|
||||
error_out() {
|
||||
umount_pseudofs
|
||||
[ -d "$BUILDDIR" -a -z "$KEEP_BUILDDIR" ] && rm -rf "$BUILDDIR"
|
||||
exit ${1:=0}
|
||||
exit "${1:=0}"
|
||||
}
|
||||
|
||||
usage() {
|
||||
@ -69,11 +69,12 @@ Options:
|
||||
-a <xbps-arch> Set XBPS_ARCH (do not use it unless you know what it is)
|
||||
-b <system-pkg> Set an alternative base-system package (defaults to base-system).
|
||||
-r <repo-url> Use this XBPS repository (may be specified multiple times).
|
||||
-c <cachedir> Use this XBPS cache directory (/var/cache/xbps if unset).
|
||||
-c <cachedir> Use this XBPS cache directory (a subdirectory of current
|
||||
directory if unset).
|
||||
-k <keymap> Default keymap to use (us if unset)
|
||||
-l <locale> Default locale to use (en_US.UTF-8 if unset).
|
||||
-i <lz4|gzip|bzip2|xz> Compression type for the initramfs image (lz4 if unset).
|
||||
-s <gzip|bzip2|xz> Compression type for the squashfs image (xz if unset)
|
||||
-i <lz4|gzip|bzip2|xz> Compression type for the initramfs image (xz if unset).
|
||||
-s <gzip|lzo|xz> Compression type for the squashfs image (xz if unset)
|
||||
-S <freesize> Allocate this free size (MB) for the rootfs.
|
||||
-o <file> Output file name for the ISO image (auto if unset).
|
||||
-p "pkg pkgN ..." Install additional packages into the ISO image.
|
||||
@ -99,133 +100,133 @@ copy_void_conf() {
|
||||
}
|
||||
|
||||
copy_dracut_files() {
|
||||
mkdir -p $1/usr/lib/dracut/modules.d/01vmklive
|
||||
cp dracut/vmklive/* $1/usr/lib/dracut/modules.d/01vmklive/
|
||||
mkdir -p "$1"/usr/lib/dracut/modules.d/01vmklive
|
||||
cp dracut/vmklive/* "$1"/usr/lib/dracut/modules.d/01vmklive/
|
||||
}
|
||||
|
||||
copy_autoinstaller_files() {
|
||||
mkdir -p $1/usr/lib/dracut/modules.d/01autoinstaller
|
||||
cp dracut/autoinstaller/* $1/usr/lib/dracut/modules.d/01autoinstaller/
|
||||
mkdir -p "$1"/usr/lib/dracut/modules.d/01autoinstaller
|
||||
cp dracut/autoinstaller/* "$1"/usr/lib/dracut/modules.d/01autoinstaller/
|
||||
}
|
||||
|
||||
install_prereqs() {
|
||||
copy_void_conf $VOIDHOSTDIR
|
||||
XBPS_ARCH=$ARCH $XBPS_INSTALL_CMD -r $VOIDHOSTDIR $XBPS_REPOSITORY \
|
||||
$XBPS_HOST_CACHEDIR -y ${REQUIRED_PKGS}
|
||||
copy_void_conf "$VOIDHOSTDIR"
|
||||
XBPS_ARCH=$ARCH "$XBPS_INSTALL_CMD" -r "$VOIDHOSTDIR" ${XBPS_REPOSITORY} \
|
||||
-c "$XBPS_HOST_CACHEDIR" -y $REQUIRED_PKGS
|
||||
[ $? -ne 0 ] && die "Failed to install required software, exiting..."
|
||||
}
|
||||
|
||||
install_packages() {
|
||||
copy_void_conf $ROOTFS
|
||||
copy_void_conf "$ROOTFS"
|
||||
|
||||
XBPS_ARCH=$BASE_ARCH ${XBPS_INSTALL_CMD} -r $ROOTFS \
|
||||
$XBPS_REPOSITORY $XBPS_CACHEDIR -yn ${PACKAGE_LIST} ${INITRAMFS_PKGS}
|
||||
XBPS_ARCH=$BASE_ARCH "${XBPS_INSTALL_CMD}" -r "$ROOTFS" \
|
||||
${XBPS_REPOSITORY} -c "$XBPS_CACHEDIR" -yn $PACKAGE_LIST $INITRAMFS_PKGS
|
||||
[ $? -ne 0 ] && die "Missing required binary packages, exiting..."
|
||||
|
||||
mount_pseudofs
|
||||
|
||||
LANG=C XBPS_ARCH=$BASE_ARCH ${XBPS_INSTALL_CMD} -U -r $ROOTFS \
|
||||
$XBPS_REPOSITORY $XBPS_CACHEDIR -y ${PACKAGE_LIST} ${INITRAMFS_PKGS}
|
||||
LANG=C XBPS_ARCH=$BASE_ARCH "${XBPS_INSTALL_CMD}" -U -r "$ROOTFS" \
|
||||
${XBPS_REPOSITORY} -c "$XBPS_CACHEDIR" -y $PACKAGE_LIST $INITRAMFS_PKGS
|
||||
[ $? -ne 0 ] && die "Failed to install $PACKAGE_LIST"
|
||||
|
||||
xbps-reconfigure -r $ROOTFS -f base-files >/dev/null 2>&1
|
||||
chroot $ROOTFS env -i xbps-reconfigure -f base-files
|
||||
xbps-reconfigure -r "$ROOTFS" -f base-files >/dev/null 2>&1
|
||||
chroot "$ROOTFS" env -i xbps-reconfigure -f base-files
|
||||
|
||||
# Enable choosen UTF-8 locale and generate it into the target rootfs.
|
||||
if [ -f $ROOTFS/etc/default/libc-locales ]; then
|
||||
sed -e "s/\#\(${LOCALE}.*\)/\1/g" -i $ROOTFS/etc/default/libc-locales
|
||||
if [ -f "$ROOTFS"/etc/default/libc-locales ]; then
|
||||
sed -e "s/\#\(${LOCALE}.*\)/\1/g" -i "$ROOTFS"/etc/default/libc-locales
|
||||
fi
|
||||
chroot $ROOTFS env -i xbps-reconfigure -a
|
||||
chroot "$ROOTFS" env -i xbps-reconfigure -a
|
||||
|
||||
if [ -x installer.sh ]; then
|
||||
install -Dm755 installer.sh $ROOTFS/usr/sbin/void-installer
|
||||
install -Dm755 installer.sh "$ROOTFS"/usr/sbin/void-installer
|
||||
else
|
||||
install -Dm755 /usr/sbin/void-installer $ROOTFS/usr/sbin/void-installer
|
||||
install -Dm755 /usr/sbin/void-installer "$ROOTFS"/usr/sbin/void-installer
|
||||
fi
|
||||
# Cleanup and remove useless stuff.
|
||||
rm -rf $ROOTFS/var/cache/* $ROOTFS/run/* $ROOTFS/var/run/*
|
||||
rm -rf "$ROOTFS"/var/cache/* "$ROOTFS"/run/* "$ROOTFS"/var/run/*
|
||||
}
|
||||
|
||||
copy_include_directory() {
|
||||
find $INCLUDE_DIRECTORY -mindepth 1 -maxdepth 1 -exec cp -rfpPv {} $ROOTFS/ \;
|
||||
find "$INCLUDE_DIRECTORY" -mindepth 1 -maxdepth 1 -exec cp -rfpPv {} "$ROOTFS"/ \;
|
||||
}
|
||||
|
||||
generate_initramfs() {
|
||||
local _args
|
||||
|
||||
copy_dracut_files $ROOTFS
|
||||
copy_autoinstaller_files $ROOTFS
|
||||
copy_dracut_files "$ROOTFS"
|
||||
copy_autoinstaller_files "$ROOTFS"
|
||||
if [ "$BASE_SYSTEM_PKG" = "base-system-systemd" ]; then
|
||||
_args="--add systemd"
|
||||
else
|
||||
_args="--omit systemd"
|
||||
fi
|
||||
chroot $ROOTFS env -i /usr/bin/dracut -N --${INITRAMFS_COMPRESSION} \
|
||||
chroot "$ROOTFS" env -i /usr/bin/dracut -N --"${INITRAMFS_COMPRESSION}" \
|
||||
--add-drivers "ahci" --force-add "vmklive autoinstaller" ${_args} "/boot/initrd" $KERNELVERSION
|
||||
[ $? -ne 0 ] && die "Failed to generate the initramfs"
|
||||
|
||||
mv $ROOTFS/boot/initrd $BOOT_DIR
|
||||
cp $ROOTFS/boot/vmlinuz-$KERNELVERSION $BOOT_DIR/vmlinuz
|
||||
mv "$ROOTFS"/boot/initrd "$BOOT_DIR"
|
||||
cp "$ROOTFS"/boot/vmlinuz-$KERNELVERSION "$BOOT_DIR"/vmlinuz
|
||||
}
|
||||
|
||||
cleanup_rootfs() {
|
||||
for f in ${INITRAMFS_PKGS}; do
|
||||
revdeps=$(xbps-query -r $ROOTFS -X $f)
|
||||
revdeps=$(xbps-query -r "$ROOTFS" -X $f)
|
||||
if [ -n "$revdeps" ]; then
|
||||
xbps-pkgdb -r $ROOTFS -m auto $f
|
||||
xbps-pkgdb -r "$ROOTFS" -m auto $f
|
||||
else
|
||||
xbps-remove -r $ROOTFS -Ry ${f} >/dev/null 2>&1
|
||||
xbps-remove -r "$ROOTFS" -Ry ${f} >/dev/null 2>&1
|
||||
fi
|
||||
done
|
||||
rm -r $ROOTFS/usr/lib/dracut/modules.d/01vmklive
|
||||
rm -r $ROOTFS/usr/lib/dracut/modules.d/01autoinstaller
|
||||
rm -r "$ROOTFS"/usr/lib/dracut/modules.d/01vmklive
|
||||
rm -r "$ROOTFS"/usr/lib/dracut/modules.d/01autoinstaller
|
||||
}
|
||||
|
||||
generate_isolinux_boot() {
|
||||
cp -f $SYSLINUX_DATADIR/isolinux.bin "$ISOLINUX_DIR"
|
||||
cp -f $SYSLINUX_DATADIR/ldlinux.c32 "$ISOLINUX_DIR"
|
||||
cp -f $SYSLINUX_DATADIR/libcom32.c32 "$ISOLINUX_DIR"
|
||||
cp -f $SYSLINUX_DATADIR/vesamenu.c32 "$ISOLINUX_DIR"
|
||||
cp -f $SYSLINUX_DATADIR/libutil.c32 "$ISOLINUX_DIR"
|
||||
cp -f $SYSLINUX_DATADIR/chain.c32 "$ISOLINUX_DIR"
|
||||
cp -f "$SYSLINUX_DATADIR"/isolinux.bin "$ISOLINUX_DIR"
|
||||
cp -f "$SYSLINUX_DATADIR"/ldlinux.c32 "$ISOLINUX_DIR"
|
||||
cp -f "$SYSLINUX_DATADIR"/libcom32.c32 "$ISOLINUX_DIR"
|
||||
cp -f "$SYSLINUX_DATADIR"/vesamenu.c32 "$ISOLINUX_DIR"
|
||||
cp -f "$SYSLINUX_DATADIR"/libutil.c32 "$ISOLINUX_DIR"
|
||||
cp -f "$SYSLINUX_DATADIR"/chain.c32 "$ISOLINUX_DIR"
|
||||
cp -f isolinux/isolinux.cfg.in "$ISOLINUX_DIR"/isolinux.cfg
|
||||
cp -f ${SPLASH_IMAGE} "$ISOLINUX_DIR"
|
||||
|
||||
sed -i -e "s|@@SPLASHIMAGE@@|$(basename ${SPLASH_IMAGE})|" \
|
||||
sed -i -e "s|@@SPLASHIMAGE@@|$(basename "${SPLASH_IMAGE}")|" \
|
||||
-e "s|@@KERNVER@@|${KERNELVERSION}|" \
|
||||
-e "s|@@KEYMAP@@|${KEYMAP}|" \
|
||||
-e "s|@@ARCH@@|$BASE_ARCH|" \
|
||||
-e "s|@@LOCALE@@|${LOCALE}|" \
|
||||
-e "s|@@BOOT_TITLE@@|${BOOT_TITLE}|" \
|
||||
-e "s|@@BOOT_CMDLINE@@|${BOOT_CMDLINE}|" \
|
||||
$ISOLINUX_DIR/isolinux.cfg
|
||||
"$ISOLINUX_DIR"/isolinux.cfg
|
||||
}
|
||||
|
||||
generate_grub_efi_boot() {
|
||||
cp -f grub/grub.cfg $GRUB_DIR
|
||||
cp -f grub/grub_void.cfg.in $GRUB_DIR/grub_void.cfg
|
||||
sed -i -e "s|@@SPLASHIMAGE@@|$(basename ${SPLASH_IMAGE})|" \
|
||||
cp -f grub/grub.cfg "$GRUB_DIR"
|
||||
cp -f grub/grub_void.cfg.in "$GRUB_DIR"/grub_void.cfg
|
||||
sed -i -e "s|@@SPLASHIMAGE@@|$(basename "${SPLASH_IMAGE}")|" \
|
||||
-e "s|@@KERNVER@@|${KERNELVERSION}|" \
|
||||
-e "s|@@KEYMAP@@|${KEYMAP}|" \
|
||||
-e "s|@@ARCH@@|$BASE_ARCH|" \
|
||||
-e "s|@@BOOT_TITLE@@|${BOOT_TITLE}|" \
|
||||
-e "s|@@BOOT_CMDLINE@@|${BOOT_CMDLINE}|" \
|
||||
-e "s|@@LOCALE@@|${LOCALE}|" $GRUB_DIR/grub_void.cfg
|
||||
mkdir -p $GRUB_DIR/fonts
|
||||
cp -f $GRUB_DATADIR/unicode.pf2 $GRUB_DIR/fonts
|
||||
-e "s|@@LOCALE@@|${LOCALE}|" "$GRUB_DIR"/grub_void.cfg
|
||||
mkdir -p "$GRUB_DIR"/fonts
|
||||
cp -f "$GRUB_DATADIR"/unicode.pf2 "$GRUB_DIR"/fonts
|
||||
|
||||
modprobe -q loop || :
|
||||
|
||||
# Create EFI vfat image.
|
||||
truncate -s 32M $GRUB_DIR/efiboot.img >/dev/null 2>&1
|
||||
truncate -s 32M "$GRUB_DIR"/efiboot.img >/dev/null 2>&1
|
||||
mkfs.vfat -F12 -S 512 -n "grub_uefi" "$GRUB_DIR/efiboot.img" >/dev/null 2>&1
|
||||
|
||||
GRUB_EFI_TMPDIR="$(mktemp --tmpdir=$HOME -d)"
|
||||
LOOP_DEVICE="$(losetup --show --find ${GRUB_DIR}/efiboot.img)"
|
||||
GRUB_EFI_TMPDIR="$(mktemp --tmpdir="$HOME" -d)"
|
||||
LOOP_DEVICE="$(losetup --show --find "${GRUB_DIR}"/efiboot.img)"
|
||||
mount -o rw,flush -t vfat "${LOOP_DEVICE}" "${GRUB_EFI_TMPDIR}" >/dev/null 2>&1
|
||||
|
||||
cp -a $IMAGEDIR/boot $VOIDHOSTDIR
|
||||
xbps-uchroot $VOIDHOSTDIR grub-mkstandalone -- \
|
||||
cp -a "$IMAGEDIR"/boot "$VOIDHOSTDIR"
|
||||
xbps-uchroot "$VOIDHOSTDIR" grub-mkstandalone -- \
|
||||
--directory="/usr/lib/grub/i386-efi" \
|
||||
--format="i386-efi" \
|
||||
--output="/tmp/bootia32.efi" \
|
||||
@ -235,9 +236,9 @@ generate_grub_efi_boot() {
|
||||
losetup --detach "${LOOP_DEVICE}"
|
||||
die "Failed to generate EFI loader"
|
||||
fi
|
||||
mkdir -p ${GRUB_EFI_TMPDIR}/EFI/BOOT
|
||||
cp -f $VOIDHOSTDIR/tmp/bootia32.efi ${GRUB_EFI_TMPDIR}/EFI/BOOT/BOOTIA32.EFI
|
||||
xbps-uchroot $VOIDHOSTDIR grub-mkstandalone -- \
|
||||
mkdir -p "${GRUB_EFI_TMPDIR}"/EFI/BOOT
|
||||
cp -f "$VOIDHOSTDIR"/tmp/bootia32.efi "${GRUB_EFI_TMPDIR}"/EFI/BOOT/BOOTIA32.EFI
|
||||
xbps-uchroot "$VOIDHOSTDIR" grub-mkstandalone -- \
|
||||
--directory="/usr/lib/grub/x86_64-efi" \
|
||||
--format="x86_64-efi" \
|
||||
--output="/tmp/bootx64.efi" \
|
||||
@ -247,10 +248,10 @@ generate_grub_efi_boot() {
|
||||
losetup --detach "${LOOP_DEVICE}"
|
||||
die "Failed to generate EFI loader"
|
||||
fi
|
||||
cp -f $VOIDHOSTDIR/tmp/bootx64.efi ${GRUB_EFI_TMPDIR}/EFI/BOOT/BOOTX64.EFI
|
||||
cp -f "$VOIDHOSTDIR"/tmp/bootx64.efi "${GRUB_EFI_TMPDIR}"/EFI/BOOT/BOOTX64.EFI
|
||||
umount "$GRUB_EFI_TMPDIR"
|
||||
losetup --detach "${LOOP_DEVICE}"
|
||||
rm -rf $GRUB_EFI_TMPDIR
|
||||
rm -rf "$GRUB_EFI_TMPDIR"
|
||||
}
|
||||
|
||||
generate_squashfs() {
|
||||
@ -263,16 +264,16 @@ generate_squashfs() {
|
||||
fi
|
||||
mkdir -p "$BUILDDIR/tmp/LiveOS"
|
||||
truncate -s "$((ROOTFS_SIZE+ROOTFS_FREESIZE))M" \
|
||||
$BUILDDIR/tmp/LiveOS/ext3fs.img >/dev/null 2>&1
|
||||
"$BUILDDIR"/tmp/LiveOS/ext3fs.img >/dev/null 2>&1
|
||||
mkdir -p "$BUILDDIR/tmp-rootfs"
|
||||
mkfs.ext3 -F -m1 "$BUILDDIR/tmp/LiveOS/ext3fs.img" >/dev/null 2>&1
|
||||
mount -o loop "$BUILDDIR/tmp/LiveOS/ext3fs.img" "$BUILDDIR/tmp-rootfs"
|
||||
cp -a $ROOTFS/* $BUILDDIR/tmp-rootfs/
|
||||
cp -a "$ROOTFS"/* "$BUILDDIR"/tmp-rootfs/
|
||||
umount -f "$BUILDDIR/tmp-rootfs"
|
||||
mkdir -p "$IMAGEDIR/LiveOS"
|
||||
|
||||
$VOIDHOSTDIR/usr/bin/mksquashfs "$BUILDDIR/tmp" "$IMAGEDIR/LiveOS/squashfs.img" \
|
||||
-comp ${SQUASHFS_COMPRESSION} || die "Failed to generate squashfs image"
|
||||
"$VOIDHOSTDIR"/usr/bin/mksquashfs "$BUILDDIR/tmp" "$IMAGEDIR/LiveOS/squashfs.img" \
|
||||
-comp "${SQUASHFS_COMPRESSION}" || die "Failed to generate squashfs image"
|
||||
chmod 444 "$IMAGEDIR/LiveOS/squashfs.img"
|
||||
|
||||
# Remove rootfs and temporary dirs, we don't need them anymore.
|
||||
@ -280,7 +281,7 @@ generate_squashfs() {
|
||||
}
|
||||
|
||||
generate_iso_image() {
|
||||
$VOIDHOSTDIR/usr/bin/xorriso -as mkisofs \
|
||||
"$VOIDHOSTDIR"/usr/bin/xorriso -as mkisofs \
|
||||
-iso-level 3 -rock -joliet \
|
||||
-max-iso9660-filenames -omit-period \
|
||||
-omit-version-number -relaxed-filenames -allow-lowercase \
|
||||
@ -289,7 +290,7 @@ generate_iso_image() {
|
||||
-eltorito-catalog boot/isolinux/boot.cat \
|
||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
||||
-eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot \
|
||||
-isohybrid-mbr $SYSLINUX_DATADIR/isohdpfx.bin \
|
||||
-isohybrid-mbr "$SYSLINUX_DATADIR"/isohdpfx.bin \
|
||||
-output "$CURDIR/$OUTPUT_FILE" "$IMAGEDIR" || die "Failed to generate ISO image"
|
||||
}
|
||||
|
||||
@ -301,7 +302,7 @@ while getopts "a:b:r:c:C:T:Kk:l:i:I:s:S:o:p:h" opt; do
|
||||
a) BASE_ARCH="$OPTARG";;
|
||||
b) BASE_SYSTEM_PKG="$OPTARG";;
|
||||
r) XBPS_REPOSITORY="--repository=$OPTARG $XBPS_REPOSITORY";;
|
||||
c) XBPS_CACHEDIR="--cachedir=$OPTARG";;
|
||||
c) XBPS_CACHEDIR="$OPTARG";;
|
||||
K) readonly KEEP_BUILDDIR=1;;
|
||||
k) KEYMAP="$OPTARG";;
|
||||
l) LOCALE="$OPTARG";;
|
||||
@ -314,18 +315,19 @@ while getopts "a:b:r:c:C:T:Kk:l:i:I:s:S:o:p:h" opt; do
|
||||
C) BOOT_CMDLINE="$OPTARG";;
|
||||
T) BOOT_TITLE="$OPTARG";;
|
||||
h) usage;;
|
||||
*) usage;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=http://repo.voidlinux.eu/current --repository=http://muslrepo.voidlinux.eu/current"
|
||||
XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=http://alpha.de.repo.voidlinux.org/current --repository=http://alpha.de.repo.voidlinux.org/current/musl"
|
||||
|
||||
ARCH=$(xbps-uhelper arch)
|
||||
|
||||
# Set defaults
|
||||
: ${BASE_ARCH:=$(xbps-uhelper arch 2>/dev/null || uname -m)}
|
||||
: ${XBPS_CACHEDIR:=-c $(pwd -P)/xbps-cachedir-${BASE_ARCH}}
|
||||
: ${XBPS_HOST_CACHEDIR:=-c $(pwd -P)/xbps-cachedir-${ARCH}}
|
||||
: ${XBPS_CACHEDIR:="$(pwd -P)"/xbps-cachedir-${BASE_ARCH}}
|
||||
: ${XBPS_HOST_CACHEDIR:="$(pwd -P)"/xbps-cachedir-${ARCH}}
|
||||
: ${KEYMAP:=us}
|
||||
: ${LOCALE:=en_US.UTF-8}
|
||||
: ${INITRAMFS_COMPRESSION:=xz}
|
||||
@ -343,13 +345,14 @@ fi
|
||||
|
||||
readonly CURDIR="$PWD"
|
||||
|
||||
|
||||
ISO_VOLUME="VOID_LIVE"
|
||||
if [ -n "$ROOTDIR" ]; then
|
||||
BUILDDIR=$(mktemp --tmpdir="$ROOTDIR" -d)
|
||||
else
|
||||
BUILDDIR=$(mktemp --tmpdir="$(pwd -P)" -d)
|
||||
fi
|
||||
BUILDDIR=$(readlink -f $BUILDDIR)
|
||||
BUILDDIR=$(readlink -f "$BUILDDIR")
|
||||
IMAGEDIR="$BUILDDIR/image"
|
||||
ROOTFS="$IMAGEDIR/rootfs"
|
||||
VOIDHOSTDIR="$BUILDDIR/void-host"
|
||||
@ -361,8 +364,8 @@ CURRENT_STEP=0
|
||||
STEP_COUNT=9
|
||||
[ -n "${INCLUDE_DIRECTORY}" ] && ((STEP_COUNT=STEP_COUNT+1))
|
||||
|
||||
: ${SYSLINUX_DATADIR:=$VOIDHOSTDIR/usr/share/syslinux}
|
||||
: ${GRUB_DATADIR:=$VOIDHOSTDIR/usr/share/grub}
|
||||
: ${SYSLINUX_DATADIR:="$VOIDHOSTDIR"/usr/share/syslinux}
|
||||
: ${GRUB_DATADIR:="$VOIDHOSTDIR"/usr/share/grub}
|
||||
: ${SPLASH_IMAGE:=data/splash.png}
|
||||
: ${XBPS_INSTALL_CMD:=xbps-install}
|
||||
: ${XBPS_REMOVE_CMD:=xbps-remove}
|
||||
@ -371,16 +374,16 @@ STEP_COUNT=9
|
||||
: ${XBPS_UHELPER_CMD:=xbps-uhelper}
|
||||
: ${XBPS_RECONFIGURE_CMD:=xbps-reconfigure}
|
||||
|
||||
mkdir -p $ROOTFS $VOIDHOSTDIR $ISOLINUX_DIR $GRUB_DIR
|
||||
mkdir -p "$ROOTFS" "$VOIDHOSTDIR" "$ISOLINUX_DIR" "$GRUB_DIR"
|
||||
|
||||
print_step "Synchronizing XBPS repository data..."
|
||||
copy_void_keys $ROOTFS
|
||||
copy_void_keys $VOIDHOSTDIR
|
||||
XBPS_ARCH=$BASE_ARCH $XBPS_INSTALL_CMD -r $ROOTFS ${XBPS_REPOSITORY} -S
|
||||
XBPS_ARCH=$ARCH $XBPS_INSTALL_CMD -r $VOIDHOSTDIR $XBPS_REPOSITORY -S
|
||||
copy_void_keys "$ROOTFS"
|
||||
copy_void_keys "$VOIDHOSTDIR"
|
||||
XBPS_ARCH=$BASE_ARCH $XBPS_INSTALL_CMD -r "$ROOTFS" ${XBPS_REPOSITORY} -S
|
||||
XBPS_ARCH=$ARCH $XBPS_INSTALL_CMD -r "$VOIDHOSTDIR" ${XBPS_REPOSITORY} -S
|
||||
|
||||
_linux_series=$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r $ROOTFS ${XBPS_REPOSITORY:=-R} -x linux|head -1)
|
||||
_kver=$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r $ROOTFS ${XBPS_REPOSITORY:=-R} -p pkgver ${_linux_series})
|
||||
_linux_series=$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -x linux|head -1)
|
||||
_kver=$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -p pkgver ${_linux_series})
|
||||
KERNELVERSION=$($XBPS_UHELPER_CMD getpkgversion ${_kver})
|
||||
|
||||
: ${OUTPUT_FILE="void-live-${BASE_ARCH}-${KERNELVERSION}-$(date +%Y%m%d).iso"}
|
||||
@ -389,8 +392,8 @@ print_step "Installing software to generate the image: ${REQUIRED_PKGS} ..."
|
||||
install_prereqs
|
||||
|
||||
mkdir -p "$ROOTFS"/etc
|
||||
[ -s data/motd ] && cp data/motd $ROOTFS/etc
|
||||
[ -s data/issue ] && cp data/issue $ROOTFS/etc
|
||||
[ -s data/motd ] && cp data/motd "$ROOTFS"/etc
|
||||
[ -s data/issue ] && cp data/issue "$ROOTFS"/etc
|
||||
|
||||
print_step "Installing void pkgs into the rootfs: ${PACKAGE_LIST} ..."
|
||||
install_packages
|
||||
@ -419,4 +422,6 @@ print_step "Generating ISO image..."
|
||||
generate_iso_image
|
||||
|
||||
hsize=$(du -sh "$CURDIR/$OUTPUT_FILE"|awk '{print $1}')
|
||||
info_msg "Created $(readlink -f $CURDIR/$OUTPUT_FILE) ($hsize) successfully."
|
||||
info_msg "Created $(readlink -f "$CURDIR"/"$OUTPUT_FILE") ($hsize) successfully."
|
||||
|
||||
|
||||
|
@ -158,7 +158,7 @@ info_msg "Install kernel and additional required netboot packages"
|
||||
# dracut-network provides the in-initrd network stack dialog is needed
|
||||
# by the install environment. ${INITRAMFS_COMPRESSION} is the name of
|
||||
# the compressor we want to use (lz4 by default).
|
||||
if [ -z "${XBPS_TARGET_ARCH##*x86*}" ] ; then
|
||||
if [ -z "${XBPS_TARGET_ARCH##*86*}" ] ; then
|
||||
# This platform is x86 or compatible, we should use
|
||||
# syslinux/pxelinux to boot the system.
|
||||
info_msg "Selecting syslinux bootloader"
|
||||
@ -177,7 +177,7 @@ run_cmd_chroot "$ROOTFS" "xbps-reconfigure -a"
|
||||
# initrd so that it can install the kernel drivers in it. Normally
|
||||
# this check is quite complex, but since this is a clean rootfs and we
|
||||
# just installed exactly one kernel, this check can get by with a
|
||||
# really niave command to figure out the kernel version
|
||||
# really naive command to figure out the kernel version
|
||||
KERNELVERSION=$(ls "$ROOTFS/usr/lib/modules/")
|
||||
|
||||
# Now that things are setup, we can call dracut and build the initrd.
|
||||
|
@ -113,7 +113,7 @@ case "$PLATFORM" in
|
||||
dockstar*) PKGS="$BASEPKG ${PLATFORM%-*}-base" ;;
|
||||
odroid-u2*) PKGS="$BASEPKG ${PLATFORM%-*}-base" ;;
|
||||
odroid-c2*) PKGS="$BASEPKG ${PLATFORM%-musl}-base" ;;
|
||||
rpi3*) PKGS="$BASEPKG rpi3-base" ;;
|
||||
rpi3*) PKGS="$BASEPKG rpi-base" ;;
|
||||
rpi2*) PKGS="$BASEPKG rpi-base" ;;
|
||||
rpi*) PKGS="$BASEPKG ${PLATFORM%-*}-base" ;;
|
||||
pogo*) PKGS="$BASEPKG ${PLATFORM%-*}-base" ;;
|
||||
|
@ -53,6 +53,7 @@ Supported architectures: i686, i686-musl, x86_64, x86_64-musl,
|
||||
armv5tel, armv5tel-musl, armv6l, armv6l-musl, armv7l, armv7l-musl
|
||||
aarch64, aarch64-musl,
|
||||
mipsel, mipsel-musl
|
||||
ppc
|
||||
|
||||
|
||||
Options
|
||||
|
Loading…
x
Reference in New Issue
Block a user