Multiple updates and fixes; needs bash and xbps>=0.21.
This commit is contained in:
parent
b1655acba5
commit
b7aa53a6c6
2
COPYING
2
COPYING
|
@ -1,6 +1,6 @@
|
||||||
Simplified BSD:
|
Simplified BSD:
|
||||||
|
|
||||||
# Copyright (c) 2009-2012 Juan Romero Pardines.
|
# Copyright (c) 2009-2013 Juan Romero Pardines.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -1,5 +1,5 @@
|
||||||
GITVER := $(shell git rev-parse HEAD)
|
GITVER := $(shell git rev-parse HEAD)
|
||||||
VERSION = 0.10
|
VERSION = 0.11
|
||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
SBINDIR ?= $(PREFIX)/sbin
|
SBINDIR ?= $(PREFIX)/sbin
|
||||||
SHAREDIR ?= $(PREFIX)/share
|
SHAREDIR ?= $(PREFIX)/share
|
||||||
|
|
5
README
5
README
|
@ -9,12 +9,13 @@ ISOLINUX is used to boot from PC-BIOS systems, while GRUB is used to
|
||||||
boot in EFI systems.
|
boot in EFI systems.
|
||||||
|
|
||||||
Dependencies:
|
Dependencies:
|
||||||
- xbps>=0.18
|
|
||||||
|
- xbps>=0.21
|
||||||
|
- GNU bash
|
||||||
- syslinux (to generate the PC-BIOS bootloader)
|
- syslinux (to generate the PC-BIOS bootloader)
|
||||||
- dosfstools (to generate the EFI bootloader)
|
- dosfstools (to generate the EFI bootloader)
|
||||||
- xorriso (to generate the ISO image)
|
- xorriso (to generate the ISO image)
|
||||||
- squashfs-tools (to generate the squashed rootfs)
|
- squashfs-tools (to generate the squashed rootfs)
|
||||||
- linux-user-chroot (to chroot and bind mount pseudofs)
|
|
||||||
|
|
||||||
Usage: void-mklive [options]
|
Usage: void-mklive [options]
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,10 @@ if [ -f ${NEWROOT}/etc/sudoers ]; then
|
||||||
echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> ${NEWROOT}/etc/sudoers
|
echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> ${NEWROOT}/etc/sudoers
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
chroot ${NEWROOT} systemctl disable graphical.target
|
||||||
|
chroot ${NEWROOT} systemctl enable multi-user.target
|
||||||
|
touch ${NEWROOT}/etc/sysctl.conf
|
||||||
|
|
||||||
# Enable autologin for agetty(8).
|
# Enable autologin for agetty(8).
|
||||||
if [ -f ${NEWROOT}/usr/lib/systemd/system/getty@.service ]; then
|
if [ -f ${NEWROOT}/usr/lib/systemd/system/getty@.service ]; then
|
||||||
rm -f "${NEWROOT}/etc/systemd/system/getty.target.wants/getty@tty1.service"
|
rm -f "${NEWROOT}/etc/systemd/system/getty.target.wants/getty@tty1.service"
|
||||||
|
|
|
@ -28,7 +28,7 @@ if [ cpuid -l ]; then
|
||||||
menuentry "Void GNU/Linux @@KERNVER@@ (@@ARCH@@)" {
|
menuentry "Void GNU/Linux @@KERNVER@@ (@@ARCH@@)" {
|
||||||
set gfxpayload="keep"
|
set gfxpayload="keep"
|
||||||
linux (${voidlive})/boot/vmlinuz \
|
linux (${voidlive})/boot/vmlinuz \
|
||||||
root=live:CDLABEL=VOID_LIVE ro rootfstype=auto liveimg \
|
root=live:CDLABEL=VOID_LIVE ro rootfstype=auto \
|
||||||
rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \
|
rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 gpt add_efi_memmap \
|
||||||
vconsole.keymap=@@KEYMAP@@ vconsole.unicode=1 locale.LANG=@@LOCALE@@
|
vconsole.keymap=@@KEYMAP@@ vconsole.unicode=1 locale.LANG=@@LOCALE@@
|
||||||
initrd (${voidlive})/boot/initrd.lz
|
initrd (${voidlive})/boot/initrd.lz
|
||||||
|
|
|
@ -23,7 +23,7 @@ MENU COLOR sel * #ffffffff #FF5255FF *
|
||||||
LABEL linux
|
LABEL linux
|
||||||
MENU LABEL Boot Void GNU/Linux @@KERNVER@@ @@ARCH@@
|
MENU LABEL Boot Void GNU/Linux @@KERNVER@@ @@ARCH@@
|
||||||
KERNEL /boot/vmlinuz
|
KERNEL /boot/vmlinuz
|
||||||
APPEND initrd=/boot/initrd.lz root=live:CDLABEL=VOID_LIVE rootfstype=auto ro rd.liveimg rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 vconsole.keymap=@@KEYMAP@@ vconsole.unicode=1 locale.LANG=@@LOCALE@@
|
APPEND initrd=/boot/initrd.lz root=live:CDLABEL=VOID_LIVE rootfstype=auto ro rd.luks=0 rd.md=0 rd.dm=0 loglevel=4 vconsole.keymap=@@KEYMAP@@ vconsole.unicode=1 locale.LANG=@@LOCALE@@
|
||||||
LABEL c
|
LABEL c
|
||||||
MENU LABEL Boot first HD found by BIOS
|
MENU LABEL Boot first HD found by BIOS
|
||||||
LOCALBOOT 0x80
|
LOCALBOOT 0x80
|
||||||
|
|
172
mklive.sh.in
172
mklive.sh.in
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2009-2012 Juan Romero Pardines.
|
# Copyright (c) 2009-2013 Juan Romero Pardines.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -23,42 +23,39 @@
|
||||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#-
|
#-
|
||||||
trap "echo; error_out $?" INT QUIT
|
set -E
|
||||||
|
trap "echo; error_out $LINENO $?" INT TERM HUP ERR
|
||||||
CHROOT_CMD="linux-user-chroot --unshare-ipc --unshare-pid --unshare-net \
|
|
||||||
--mount-bind /dev /dev --mount-bind /sys /sys --mount-proc /proc"
|
|
||||||
|
|
||||||
info_msg() {
|
info_msg() {
|
||||||
printf "\033[1m$@\n\033[m"
|
printf "\033[1m$@\n\033[m"
|
||||||
}
|
}
|
||||||
|
|
||||||
error_out() {
|
error_out() {
|
||||||
info_msg "There was an error! cleaning up $BUILDDIR, exiting..."
|
info_msg "There was an error in line $1 ... cleaning up $BUILDDIR, exiting."
|
||||||
|
|
||||||
|
umount_kernel_fs
|
||||||
|
|
||||||
[ -d "$BUILDDIR" ] && rm -rf "$BUILDDIR"
|
[ -d "$BUILDDIR" ] && rm -rf "$BUILDDIR"
|
||||||
#[ -f "$LOGFILE" ] && rm -f "$LOGFILE"
|
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
umount_kernel_fs() {
|
||||||
|
for f in sys/fs/cgroup/systemd sys/fs/cgroup dev/shm dev/pts dev proc sys run; do
|
||||||
|
umount -f $ROOTFS/kernel_temp/$f &>/dev/null
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
write_etc_motd() {
|
write_etc_motd() {
|
||||||
cat >> "$ROOTFS/etc/motd" <<_EOF
|
cat >> "$ROOTFS/etc/motd" <<_EOF
|
||||||
###############################################################################
|
###############################################################################
|
||||||
Autogenerated by void-mklive "0.10 3d7b51707195b6e765b4d1d59d70266ebe87ce1e"
|
Autogenerated by void-mklive "@@MKLIVE_VERSION@@"
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Welcome to the Void Linux Live system, you have been autologged in.
|
Welcome to the Void Linux Live system, you have been autologged in.
|
||||||
This user has full sudo(8) permissions without any password, be careful
|
This user has full sudo(8) permissions without any password, be careful
|
||||||
executing commands through sudo(8).
|
executing commands through sudo(8).
|
||||||
|
|
||||||
To play with package management use the xbps-* utilities. Please visit:
|
|
||||||
|
|
||||||
http://code.google.com/p/xbps/
|
|
||||||
|
|
||||||
for more information and/or documentation about using the X Binary
|
|
||||||
Package System. If you think it is useful, please make a donation
|
|
||||||
to improve further development from the above URL, thanks.
|
|
||||||
|
|
||||||
To start the installation please type:
|
To start the installation please type:
|
||||||
|
|
||||||
$ sudo void-installer
|
$ sudo void-installer
|
||||||
|
@ -109,14 +106,14 @@ usage()
|
||||||
Usage: $(basename $0) [options]
|
Usage: $(basename $0) [options]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-C file Path to configuration file (defaults to ~/.mklive.conf)
|
-C file Path to configuration file (defaults to ~/.mklive.conf)
|
||||||
-c (gzip|bzip2|xz) ompression type for the squashfs/initramfs image.
|
-c (gzip|bzip2|xz) Compression type for the squashfs/initramfs image.
|
||||||
-l "pkgname ..." Generate a local repository in the image with these packages.
|
-l "pkgname ..." Generate a local repository in the image with these packages.
|
||||||
Packages must be delimited by blanks.
|
Packages must be delimited by blanks.
|
||||||
-r rootdir Use this directory to generate the image (if unset,
|
-r rootdir Use this directory to generate the image (if unset,
|
||||||
current working directory will be used).
|
current working directory will be used).
|
||||||
-o outfile Output file name for the ISO image.
|
-o outfile Output file name for the ISO image.
|
||||||
-s splash Splash image file for isolinux.
|
-s splash Splash image file for isolinux.
|
||||||
_EOF
|
_EOF
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
@ -132,16 +129,12 @@ install_packages() {
|
||||||
error_out
|
error_out
|
||||||
fi
|
fi
|
||||||
${XBPS_INSTALL_CMD} ${XBPS_ARGS} ${PACKAGE_LIST} >>$LOGFILE 2>&1
|
${XBPS_INSTALL_CMD} ${XBPS_ARGS} ${PACKAGE_LIST} >>$LOGFILE 2>&1
|
||||||
[ $? -ne 0 ] && error_out $?
|
|
||||||
${XBPS_INSTALL_CMD} ${XBPS_ARGS} -u >>$LOGFILE 2>&1
|
${XBPS_INSTALL_CMD} ${XBPS_ARGS} -u >>$LOGFILE 2>&1
|
||||||
[ $? -ne 0 ] && error_out $?
|
|
||||||
${XBPS_REMOVE_CMD} ${XBPS_ARGS} -o >>$LOGFILE 2>&1
|
${XBPS_REMOVE_CMD} ${XBPS_ARGS} -o >>$LOGFILE 2>&1
|
||||||
[ $? -ne 0 ] && error_out $?
|
${XBPS_QUERY_CMD} -r "$ROOTFS" -l > "${OUTPUT_FILE%.iso}"-package-list.txt
|
||||||
${XBPS_QUERY_CMD} -r "$ROOTFS" -l > \
|
|
||||||
"${OUTPUT_FILE%.iso}"-package-list.txt || error_out
|
|
||||||
|
|
||||||
# Reconfigure all pkgs again via linux-user-chroot.
|
# Reconfigure all pkgs again via linux-user-chroot.
|
||||||
$CHROOT_CMD $ROOTFS xbps-reconfigure -fa >>$LOGFILE 2>&1
|
chroot $ROOTFS /usr/sbin/xbps-reconfigure -fa >>$LOGFILE 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_initramfs() {
|
generate_initramfs() {
|
||||||
|
@ -151,23 +144,26 @@ generate_initramfs() {
|
||||||
base-system void-mklive >>$LOGFILE 2>&1
|
base-system void-mklive >>$LOGFILE 2>&1
|
||||||
|
|
||||||
# Install some required utilities from util-linux.
|
# Install some required utilities from util-linux.
|
||||||
install -Dm755 $ROOTFS/kernel_temp/usr/sbin/agetty \
|
install -Dm755 $ROOTFS/kernel_temp/usr/bin/mount "$ROOTFS/usr/bin/mount"
|
||||||
"$ROOTFS/usr/sbin/agetty" || error_out $?
|
install -Dm755 $ROOTFS/kernel_temp/usr/sbin/agetty "$ROOTFS/usr/sbin/agetty"
|
||||||
install -Dm755 $ROOTFS/kernel_temp/usr/bin/lsblk \
|
install -Dm755 $ROOTFS/kernel_temp/usr/bin/lsblk "$ROOTFS/usr/bin/lsblk"
|
||||||
"$ROOTFS/usr/bin/lsblk" || error_out $?
|
|
||||||
# Install stdbuf from coreutils, required by void-installer.
|
# Install stdbuf from coreutils, required by void-installer.
|
||||||
install -Dm755 $ROOTFS/kernel_temp/usr/bin/stdbuf \
|
install -Dm755 $ROOTFS/kernel_temp/usr/bin/stdbuf "$ROOTFS/usr/bin/stdbuf"
|
||||||
"$ROOTFS/usr/bin/stdbuf" || error_out $?
|
|
||||||
install -Dm755 $ROOTFS/kernel_temp/usr/libexec/coreutils/libstdbuf.so \
|
install -Dm755 $ROOTFS/kernel_temp/usr/libexec/coreutils/libstdbuf.so \
|
||||||
"$ROOTFS/usr/libexec/coreutils/libstdbuf.so" || error_out $?
|
"$ROOTFS/usr/libexec/coreutils/libstdbuf.so"
|
||||||
|
|
||||||
|
chroot $ROOTFS/kernel_temp /usr/bin/dracut --no-hostonly \
|
||||||
|
--add " dmsquash-live vmklive " --${COMPRESSTYPE} \
|
||||||
|
"/boot/initrd.lz" >>$LOGFILE 2>&1
|
||||||
|
|
||||||
|
umount_kernel_fs
|
||||||
|
|
||||||
$CHROOT_CMD $ROOTFS/kernel_temp dracut --no-hostonly \
|
|
||||||
--add "dmsquash-live vmklive" --${COMPRESSTYPE} \
|
|
||||||
"/boot/initrd.lz" 2>/dev/null || error_out
|
|
||||||
mv $ROOTFS/kernel_temp/boot/initrd.lz $BOOT_DIR
|
mv $ROOTFS/kernel_temp/boot/initrd.lz $BOOT_DIR
|
||||||
# We rely on pam now, so let's install the host login config.
|
# We rely on pam now, so let's install the host login config.
|
||||||
install -Dm644 $ROOTFS/kernel_temp/etc/pam.d/login \
|
install -Dm644 $ROOTFS/kernel_temp/etc/pam.d/login \
|
||||||
"$ROOTFS/etc/pam.d/login" || error_out $?
|
"$ROOTFS/etc/pam.d/login"
|
||||||
|
# Remove pam_motd.so; busybox login already prints it.
|
||||||
|
sed -e '/^.*pam_motd.so*/d' -i "$ROOTFS/etc/pam.d/login"
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_kernel_and_modules() {
|
copy_kernel_and_modules() {
|
||||||
|
@ -176,33 +172,36 @@ copy_kernel_and_modules() {
|
||||||
mkdir -p $ROOTFS/lib/modules
|
mkdir -p $ROOTFS/lib/modules
|
||||||
cp -a $ROOTFS/kernel_temp/lib/modules/${KERNELVERSION} \
|
cp -a $ROOTFS/kernel_temp/lib/modules/${KERNELVERSION} \
|
||||||
$ROOTFS/lib/modules
|
$ROOTFS/lib/modules
|
||||||
|
|
||||||
# remove temporary rootfs.
|
# remove temporary rootfs.
|
||||||
rm -rf $ROOTFS/kernel_temp
|
rm -rf $ROOTFS/kernel_temp
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_local_repository() {
|
generate_local_repository() {
|
||||||
mkdir -p $ROOTFS/packages
|
mkdir -p $ROOTFS/packages
|
||||||
pkgs=$($XBPS_INSTALL_CMD -s -r /tmp/blah -n ${LOCALREPO_PKGLIST})
|
pkgs=$($XBPS_INSTALL_CMD -r /tmp/blah -n ${LOCALREPO_PKGLIST})
|
||||||
set -- ${pkgs}
|
set -- ${pkgs}
|
||||||
while [ $# -ne 0 ]; do
|
while [ $# -ne 0 ]; do
|
||||||
pkgn=$1; action=$2; ver=$3; repo=$4; binpkg=$5; arch=$6
|
pkg=$1; action=$2; arch=$3; repo=$4;
|
||||||
shift 6
|
shift 4
|
||||||
bpkg=$repo/$binpkg
|
bpkg=${repo}/${pkg}.${arch}.xbps
|
||||||
cp -f $bpkg $ROOTFS/packages
|
cp -f $bpkg $ROOTFS/packages
|
||||||
done
|
done
|
||||||
LD_LIBRARY_PATH="$ROOTFS/usr/lib" \
|
LD_LIBRARY_PATH="$ROOTFS/usr/lib" \
|
||||||
$ROOTFS/usr/sbin/$XBPS_RINDEX_CMD -a $ROOTFS/packages/*.xbps 2>&1 >>$LOGFILE
|
$ROOTFS/usr/sbin/$XBPS_RINDEX_CMD -a $ROOTFS/packages/*.xbps 2>&1 >>$LOGFILE
|
||||||
rm -f $ROOTFS/packages/index-files.plist
|
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_isolinux_boot() {
|
generate_isolinux_boot() {
|
||||||
cp -f $SYSLINUX_DATADIR/isolinux.bin "$ISOLINUX_DIR" || error_out $?
|
cp -f $SYSLINUX_DATADIR/isolinux.bin "$ISOLINUX_DIR"
|
||||||
cp -f $SYSLINUX_DATADIR/vesamenu.c32 "$ISOLINUX_DIR" || error_out $?
|
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 $MKLIVE_DATADIR/isolinux.cfg.in \
|
cp -f $MKLIVE_DATADIR/isolinux.cfg.in \
|
||||||
"$ISOLINUX_DIR"/isolinux.cfg || error_out $?
|
"$ISOLINUX_DIR"/isolinux.cfg
|
||||||
|
|
||||||
if [ -f "$SPLASH_IMAGE" ]; then
|
if [ -f "$SPLASH_IMAGE" ]; then
|
||||||
cp -f $SPLASH_IMAGE "$ISOLINUX_DIR" || error_out $?
|
cp -f $SPLASH_IMAGE "$ISOLINUX_DIR"
|
||||||
fi
|
fi
|
||||||
sed -i -e "s|@@SPLASHIMAGE@@|$(basename $SPLASH_IMAGE)|" \
|
sed -i -e "s|@@SPLASHIMAGE@@|$(basename $SPLASH_IMAGE)|" \
|
||||||
-e "s|@@KERNVER@@|${KERNELVERSION}|" \
|
-e "s|@@KERNVER@@|${KERNELVERSION}|" \
|
||||||
|
@ -212,38 +211,34 @@ generate_isolinux_boot() {
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_grub_efi_boot() {
|
generate_grub_efi_boot() {
|
||||||
cp -f $MKLIVE_DATADIR/grub.cfg $GRUB_DIR || error_out $?
|
cp -f $MKLIVE_DATADIR/grub.cfg $GRUB_DIR
|
||||||
cp -f $MKLIVE_DATADIR/grub_void.cfg.in \
|
cp -f $MKLIVE_DATADIR/grub_void.cfg.in $GRUB_DIR/grub_void.cfg
|
||||||
$GRUB_DIR/grub_void.cfg || error_out $?
|
|
||||||
sed -i -e "s|@@SPLASHIMAGE@@|$(basename $SPLASH_IMAGE)|" \
|
sed -i -e "s|@@SPLASHIMAGE@@|$(basename $SPLASH_IMAGE)|" \
|
||||||
-e "s|@@KERNVER@@|${KERNELVERSION}|" \
|
-e "s|@@KERNVER@@|${KERNELVERSION}|" \
|
||||||
-e "s|@@KEYMAP@@|${KEYMAP}|" \
|
-e "s|@@KEYMAP@@|${KEYMAP}|" \
|
||||||
-e "s|@@ARCH@@|$(uname -m)|" \
|
-e "s|@@ARCH@@|$(uname -m)|" \
|
||||||
-e "s|@@LOCALE@@|${LOCALE}|" $GRUB_DIR/grub_void.cfg
|
-e "s|@@LOCALE@@|${LOCALE}|" $GRUB_DIR/grub_void.cfg
|
||||||
mkdir -p $GRUB_DIR/fonts $GRUB_DIR/locale || error_out $?
|
mkdir -p $GRUB_DIR/fonts $GRUB_DIR/locale
|
||||||
cp -f $GRUB_DATADIR/unicode.pf2 $GRUB_DIR/fonts || error_out $?
|
cp -f $GRUB_DATADIR/unicode.pf2 $GRUB_DIR/fonts
|
||||||
cp -f /boot/grub/locale/* $GRUB_DIR/locale || error_out $?
|
cp -f /boot/grub/locale/* $GRUB_DIR/locale
|
||||||
|
|
||||||
# Create EFI vfat image.
|
# Create EFI vfat image.
|
||||||
dd if=/dev/zero of=$GRUB_DIR/efiboot.img bs=1024 count=4096 \
|
dd if=/dev/zero of=$GRUB_DIR/efiboot.img bs=1024 count=4096 >>$LOGFILE 2>&1
|
||||||
>>$LOGFILE 2>&1 || error_out $?
|
mkfs.vfat -F12 -S 512 -n "grub_uefi" "$GRUB_DIR/efiboot.img" >>$LOGFILE 2>&1
|
||||||
mkfs.vfat -F12 -S 512 -n "grub_uefi" "$GRUB_DIR/efiboot.img" \
|
|
||||||
>>$LOGFILE 2>&1 || error_out $?
|
|
||||||
|
|
||||||
GRUB_EFI_TMPDIR="$(mktemp --tmpdir=$HOME -d)"
|
GRUB_EFI_TMPDIR="$(mktemp --tmpdir=$HOME -d)"
|
||||||
LOOP_DEVICE="$(losetup --show --find ${GRUB_DIR}/efiboot.img)"
|
LOOP_DEVICE="$(losetup --show --find ${GRUB_DIR}/efiboot.img)"
|
||||||
mount -o rw,flush -t vfat "${LOOP_DEVICE}" "${GRUB_EFI_TMPDIR}" \
|
mount -o rw,flush -t vfat "${LOOP_DEVICE}" "${GRUB_EFI_TMPDIR}" >>$LOGFILE 2>&1
|
||||||
>>$LOGFILE 2>&1 || error_out $?
|
|
||||||
|
|
||||||
mkdir -p "${GRUB_EFI_TMPDIR}/EFI/boot/" || error_out $?
|
mkdir -p "${GRUB_EFI_TMPDIR}/EFI/boot/"
|
||||||
cd "$BUILDDIR" || error_out $?
|
cd "$BUILDDIR"
|
||||||
grub-mkstandalone --directory="/usr/lib/grub/x86_64-efi" \
|
grub-mkstandalone --directory="/usr/lib/grub/x86_64-efi" \
|
||||||
--format="x86_64-efi" \
|
--format="x86_64-efi" \
|
||||||
--compression="xz" --output="${GRUB_EFI_TMPDIR}/EFI/boot/bootx64.efi" \
|
--compression="xz" --output="${GRUB_EFI_TMPDIR}/EFI/boot/bootx64.efi" \
|
||||||
"boot/grub/grub.cfg" >>$LOGFILE 2>&1 || error_out $?
|
"boot/grub/grub.cfg" >>$LOGFILE 2>&1
|
||||||
umount "$GRUB_EFI_TMPDIR" || error_out $?
|
umount "$GRUB_EFI_TMPDIR"
|
||||||
losetup --detach "${LOOP_DEVICE}" || error_out $?
|
losetup --detach "${LOOP_DEVICE}"
|
||||||
rm -rf $GRUB_EFI_TMPDIR || error_out $?
|
rm -rf $GRUB_EFI_TMPDIR
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_squashfs() {
|
generate_squashfs() {
|
||||||
|
@ -251,23 +246,20 @@ generate_squashfs() {
|
||||||
ROOTFS_SIZE=$(du -sk "$ROOTFS"|awk '{print $1}')
|
ROOTFS_SIZE=$(du -sk "$ROOTFS"|awk '{print $1}')
|
||||||
mkdir -p "$BUILDDIR/tmp/LiveOS"
|
mkdir -p "$BUILDDIR/tmp/LiveOS"
|
||||||
dd if=/dev/zero of="$BUILDDIR/tmp/LiveOS/ext3fs.img" \
|
dd if=/dev/zero of="$BUILDDIR/tmp/LiveOS/ext3fs.img" \
|
||||||
bs="$((${ROOTFS_SIZE}+($ROOTFS_SIZE/6)))K" count=1 \
|
bs="$((${ROOTFS_SIZE}+($ROOTFS_SIZE/6)))K" count=1 >>$LOGFILE 2>&1
|
||||||
>>$LOGFILE 2>&1 || error_out $?
|
|
||||||
mkdir -p "$BUILDDIR/tmp-rootfs"
|
mkdir -p "$BUILDDIR/tmp-rootfs"
|
||||||
mkfs.ext3 -F -m1 "$BUILDDIR/tmp/LiveOS/ext3fs.img" \
|
mkfs.ext3 -F -m1 "$BUILDDIR/tmp/LiveOS/ext3fs.img" >>$LOGFILE 2>&1
|
||||||
>>$LOGFILE 2>&1 || error_out $?
|
mount -o loop "$BUILDDIR/tmp/LiveOS/ext3fs.img" "$BUILDDIR/tmp-rootfs"
|
||||||
mount -o loop "$BUILDDIR/tmp/LiveOS/ext3fs.img" \
|
|
||||||
"$BUILDDIR/tmp-rootfs" || error_out $?
|
|
||||||
cd $BUILDDIR
|
cd $BUILDDIR
|
||||||
cp -a rootfs/* tmp-rootfs/
|
cp -a rootfs/* tmp-rootfs/
|
||||||
umount -f "$BUILDDIR/tmp-rootfs"
|
umount -f "$BUILDDIR/tmp-rootfs"
|
||||||
mkdir -p "$BUILDDIR/LiveOS"
|
mkdir -p "$BUILDDIR/LiveOS"
|
||||||
|
|
||||||
mksquashfs "$BUILDDIR/tmp" "$BUILDDIR/LiveOS/squashfs.img" \
|
mksquashfs "$BUILDDIR/tmp" "$BUILDDIR/LiveOS/squashfs.img" \
|
||||||
-comp ${COMPRESSTYPE} >>$LOGFILE 2>&1 || error_out
|
-comp ${COMPRESSTYPE} >>$LOGFILE 2>&1
|
||||||
chmod 444 "$BUILDDIR/LiveOS/squashfs.img" || error_out $?
|
chmod 444 "$BUILDDIR/LiveOS/squashfs.img"
|
||||||
# Remove rootfs and temporary dirs, we don't need them anymore.
|
# Remove rootfs and temporary dirs, we don't need them anymore.
|
||||||
rm -rf "$ROOTFS" "$BUILDDIR/tmp-rootfs" "$BUILDDIR/tmp" || error_out $?
|
rm -rf "$ROOTFS" "$BUILDDIR/tmp-rootfs" "$BUILDDIR/tmp"
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_iso_image() {
|
generate_iso_image() {
|
||||||
|
@ -280,8 +272,8 @@ generate_iso_image() {
|
||||||
-eltorito-catalog boot/isolinux/boot.cat \
|
-eltorito-catalog boot/isolinux/boot.cat \
|
||||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
||||||
-eltorito-alt-boot --efi-boot boot/grub/efiboot.img -no-emul-boot \
|
-eltorito-alt-boot --efi-boot boot/grub/efiboot.img -no-emul-boot \
|
||||||
-isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \
|
-isohybrid-mbr $SYSLINUX_DATADIR/isohdpfx.bin \
|
||||||
-output "$OUTPUT_FILE" "$BUILDDIR" >>$LOGFILE 2>&1 || error_out $?
|
-output "$OUTPUT_FILE" "$BUILDDIR" >>$LOGFILE 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -290,12 +282,12 @@ generate_iso_image() {
|
||||||
while getopts "C:c:l:o:r:s:h" opt; do
|
while getopts "C:c:l:o:r:s:h" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
C) CONFIG_FILE="$OPTARG";;
|
C) CONFIG_FILE="$OPTARG";;
|
||||||
c) COMPRESSTYPE="$OPTARG";;
|
c) COMPRESSTYPE="$OPTARG";;
|
||||||
l) LOCALREPO_PKGLIST="$OPTARG";;
|
l) LOCALREPO_PKGLIST="$OPTARG";;
|
||||||
o) OUTPUT_FILE="$OPTARG";;
|
o) OUTPUT_FILE="$OPTARG";;
|
||||||
r) ROOTDIR="$OPTARG";;
|
r) ROOTDIR="$OPTARG";;
|
||||||
s) SPLASH_IMAGE="$OPTARG";;
|
s) SPLASH_IMAGE="$OPTARG";;
|
||||||
h) usage;;
|
h) usage;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
@ -366,9 +358,9 @@ fi
|
||||||
|
|
||||||
ISO_VOLUME="VOID_LIVE"
|
ISO_VOLUME="VOID_LIVE"
|
||||||
if [ -n "$ROOTDIR" ]; then
|
if [ -n "$ROOTDIR" ]; then
|
||||||
BUILDDIR=$(mktemp --tmpdir="$ROOTDIR" -d) || exit 1
|
BUILDDIR=$(mktemp --tmpdir="$ROOTDIR" -d)
|
||||||
else
|
else
|
||||||
BUILDDIR=$(mktemp --tmpdir="$(pwd -P)" -d) || exit 1
|
BUILDDIR=$(mktemp --tmpdir="$(pwd -P)" -d)
|
||||||
fi
|
fi
|
||||||
BUILDDIR=$(readlink -f $BUILDDIR)
|
BUILDDIR=$(readlink -f $BUILDDIR)
|
||||||
ROOTFS="$BUILDDIR/rootfs"
|
ROOTFS="$BUILDDIR/rootfs"
|
||||||
|
@ -393,9 +385,9 @@ if [ -n "$REPOSITORY_CACHE" ]; then
|
||||||
fi
|
fi
|
||||||
XBPS_VERSION=$($XBPS_QUERY_CMD -V|awk '{print $2}')
|
XBPS_VERSION=$($XBPS_QUERY_CMD -V|awk '{print $2}')
|
||||||
case $XBPS_VERSION in
|
case $XBPS_VERSION in
|
||||||
# XBPS >= 0.18
|
# XBPS >= 0.21
|
||||||
[0-9].[1-9][8-9]*|[0-9].[2-9][0-9]*) ;;
|
[0-9].[2-9][1-9]*) ;;
|
||||||
*) echo "Your xbps utilities are too old ($XBPS_VERSION), 0.18 is required." && exit 1;;
|
*) echo "Your xbps utilities are too old ($XBPS_VERSION), 0.21 is required."; exit 1;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
KERNELVERSION=$($XBPS_QUERY_CMD -R --property version kernel)
|
KERNELVERSION=$($XBPS_QUERY_CMD -R --property version kernel)
|
||||||
|
@ -464,7 +456,7 @@ info_msg "[8/9] Generating ISO image..."
|
||||||
generate_iso_image
|
generate_iso_image
|
||||||
|
|
||||||
info_msg "[9/9] Removing build directory..."
|
info_msg "[9/9] Removing build directory..."
|
||||||
rm -rf "$BUILDDIR" || error_out $?
|
rm -rf "$BUILDDIR"
|
||||||
|
|
||||||
hsize=$(du -sh "$OUTPUT_FILE"|awk '{print $1}')
|
hsize=$(du -sh "$OUTPUT_FILE"|awk '{print $1}')
|
||||||
info_msg "Created $(readlink -f $OUTPUT_FILE) ($hsize) successfully."
|
info_msg "Created $(readlink -f $OUTPUT_FILE) ($hsize) successfully."
|
||||||
|
|
Loading…
Reference in New Issue