mklive.sh.in: fix generation of local repo; use target xbps utils; indent
This commit is contained in:
parent
3d7b517071
commit
1f2372b35b
214
mklive.sh.in
214
mklive.sh.in
@ -23,31 +23,28 @@
|
|||||||
# (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.
|
||||||
#-
|
#-
|
||||||
|
|
||||||
# vim: set ts=4 sw=4 et:
|
|
||||||
|
|
||||||
trap "echo; error_out $?" INT QUIT
|
trap "echo; error_out $?" INT QUIT
|
||||||
|
|
||||||
CHROOT_CMD="linux-user-chroot --unshare-ipc --unshare-pid --unshare-net \
|
CHROOT_CMD="linux-user-chroot --unshare-ipc --unshare-pid --unshare-net \
|
||||||
--mount-bind /dev /dev --mount-bind /sys /sys --mount-proc /proc"
|
--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! cleaning up $BUILDDIR, exiting..."
|
||||||
|
|
||||||
[ -d "$BUILDDIR" ] && rm -rf "$BUILDDIR"
|
[ -d "$BUILDDIR" ] && rm -rf "$BUILDDIR"
|
||||||
#[ -f "$LOGFILE" ] && rm -f "$LOGFILE"
|
#[ -f "$LOGFILE" ] && rm -f "$LOGFILE"
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
write_etc_motd() {
|
write_etc_motd() {
|
||||||
cat >> "$ROOTFS/etc/motd" <<_EOF
|
cat >> "$ROOTFS/etc/motd" <<_EOF
|
||||||
###############################################################################
|
###############################################################################
|
||||||
Autogenerated by void-mklive "@@MKLIVE_VERSION@@"
|
Autogenerated by void-mklive "0.10 3d7b51707195b6e765b4d1d59d70266ebe87ce1e"
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
Welcome to the Void Linux Live system, you have been autologged in.
|
Welcome to the Void Linux Live system, you have been autologged in.
|
||||||
@ -56,7 +53,7 @@ executing commands through sudo(8).
|
|||||||
|
|
||||||
To play with package management use the xbps-* utilities. Please visit:
|
To play with package management use the xbps-* utilities. Please visit:
|
||||||
|
|
||||||
http://code.google.com/p/xbps/
|
http://code.google.com/p/xbps/
|
||||||
|
|
||||||
for more information and/or documentation about using the X Binary
|
for more information and/or documentation about using the X Binary
|
||||||
Package System. If you think it is useful, please make a donation
|
Package System. If you think it is useful, please make a donation
|
||||||
@ -64,7 +61,7 @@ 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
|
||||||
|
|
||||||
and follow the on-screen instructions. Thanks for trying Void Linux.
|
and follow the on-screen instructions. Thanks for trying Void Linux.
|
||||||
|
|
||||||
@ -73,7 +70,7 @@ _EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
write_conf_file() {
|
write_conf_file() {
|
||||||
cat > "$1" <<_EOF
|
cat > "$1" <<_EOF
|
||||||
# *-*- sh -*-*
|
# *-*- sh -*-*
|
||||||
# Default configuration file for vmklive-@VERSION@.
|
# Default configuration file for vmklive-@VERSION@.
|
||||||
#
|
#
|
||||||
@ -103,36 +100,36 @@ LOCALE=en_US.UTF-8
|
|||||||
#REPOSITORY_CACHE=/blah/foo
|
#REPOSITORY_CACHE=/blah/foo
|
||||||
|
|
||||||
_EOF
|
_EOF
|
||||||
chmod 644 "$1"
|
chmod 644 "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
cat <<_EOF
|
cat <<_EOF
|
||||||
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) Compression type for the squashfs/initramfs image.
|
-c (gzip|bzip2|xz) ompression 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
|
||||||
}
|
}
|
||||||
|
|
||||||
install_packages() {
|
install_packages() {
|
||||||
for f in ${PACKAGE_LIST}; do
|
for f in ${PACKAGE_LIST}; do
|
||||||
info_msg " $f"
|
info_msg " $f"
|
||||||
done
|
done
|
||||||
# Check that all pkgs are reachable.
|
# Check that all pkgs are reachable.
|
||||||
${XBPS_INSTALL_CMD} ${XBPS_ARGS} -n ${PACKAGE_LIST} >>$LOGFILE 2>&1
|
${XBPS_INSTALL_CMD} ${XBPS_ARGS} -n ${PACKAGE_LIST} >>$LOGFILE 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
info_msg "Missing required binary packages, exiting..."
|
info_msg "Missing required binary packages, exiting..."
|
||||||
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 $?
|
[ $? -ne 0 ] && error_out $?
|
||||||
@ -141,7 +138,7 @@ install_packages() {
|
|||||||
${XBPS_REMOVE_CMD} ${XBPS_ARGS} -o >>$LOGFILE 2>&1
|
${XBPS_REMOVE_CMD} ${XBPS_ARGS} -o >>$LOGFILE 2>&1
|
||||||
[ $? -ne 0 ] && error_out $?
|
[ $? -ne 0 ] && error_out $?
|
||||||
${XBPS_QUERY_CMD} -r "$ROOTFS" -l > \
|
${XBPS_QUERY_CMD} -r "$ROOTFS" -l > \
|
||||||
"${OUTPUT_FILE%.iso}"-package-list.txt || error_out
|
"${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_CMD $ROOTFS xbps-reconfigure -fa >>$LOGFILE 2>&1
|
||||||
@ -151,22 +148,22 @@ generate_initramfs() {
|
|||||||
# Install required pkgs in a temporary rootdir to create
|
# Install required pkgs in a temporary rootdir to create
|
||||||
# the initramfs and to copy required files.
|
# the initramfs and to copy required files.
|
||||||
$XBPS_INSTALL_CMD -r $ROOTFS/kernel_temp -y \
|
$XBPS_INSTALL_CMD -r $ROOTFS/kernel_temp -y \
|
||||||
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/sbin/agetty \
|
||||||
"$ROOTFS/usr/sbin/agetty" || error_out $?
|
"$ROOTFS/usr/sbin/agetty" || error_out $?
|
||||||
install -Dm755 $ROOTFS/kernel_temp/usr/bin/lsblk \
|
install -Dm755 $ROOTFS/kernel_temp/usr/bin/lsblk \
|
||||||
"$ROOTFS/usr/bin/lsblk" || error_out $?
|
"$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" || error_out $?
|
"$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" || error_out $?
|
||||||
|
|
||||||
$CHROOT_CMD $ROOTFS/kernel_temp dracut --no-hostonly \
|
$CHROOT_CMD $ROOTFS/kernel_temp dracut --no-hostonly \
|
||||||
--add "dmsquash-live vmklive" --${COMPRESSTYPE} \
|
--add "dmsquash-live vmklive" --${COMPRESSTYPE} \
|
||||||
"/boot/initrd.lz" 2>/dev/null || error_out
|
"/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 \
|
||||||
@ -188,12 +185,13 @@ generate_local_repository() {
|
|||||||
pkgs=$($XBPS_INSTALL_CMD -s -r /tmp/blah -n ${LOCALREPO_PKGLIST})
|
pkgs=$($XBPS_INSTALL_CMD -s -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
|
pkgn=$1; action=$2; ver=$3; repo=$4; binpkg=$5; arch=$6
|
||||||
shift 6
|
shift 6
|
||||||
bpkg=$repo/$arch/$binpkg
|
bpkg=$repo/$binpkg
|
||||||
cp -f $bpkg $ROOTFS/packages
|
cp -f $bpkg $ROOTFS/packages
|
||||||
done
|
done
|
||||||
$XBPS_RINDEX_CMD -a $ROOTFS/packages/*.xbps 2>&1 >>$LOGFILE
|
LD_PRELOAD="$ROOTFS/usr/lib/libxbps.so" \
|
||||||
|
$ROOTFS/usr/sbin/$XBPS_RINDEX_CMD -a $ROOTFS/packages/*.xbps 2>&1 >>$LOGFILE
|
||||||
rm -f $ROOTFS/packages/index-files.plist
|
rm -f $ROOTFS/packages/index-files.plist
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,16 +199,16 @@ generate_isolinux_boot() {
|
|||||||
cp -f $SYSLINUX_DATADIR/isolinux.bin "$ISOLINUX_DIR" || error_out $?
|
cp -f $SYSLINUX_DATADIR/isolinux.bin "$ISOLINUX_DIR" || error_out $?
|
||||||
cp -f $SYSLINUX_DATADIR/vesamenu.c32 "$ISOLINUX_DIR" || error_out $?
|
cp -f $SYSLINUX_DATADIR/vesamenu.c32 "$ISOLINUX_DIR" || error_out $?
|
||||||
cp -f $MKLIVE_DATADIR/isolinux.cfg.in \
|
cp -f $MKLIVE_DATADIR/isolinux.cfg.in \
|
||||||
"$ISOLINUX_DIR"/isolinux.cfg || error_out $?
|
"$ISOLINUX_DIR"/isolinux.cfg || error_out $?
|
||||||
|
|
||||||
if [ -f "$SPLASH_IMAGE" ]; then
|
if [ -f "$SPLASH_IMAGE" ]; then
|
||||||
cp -f $SPLASH_IMAGE "$ISOLINUX_DIR" || error_out $?
|
cp -f $SPLASH_IMAGE "$ISOLINUX_DIR" || error_out $?
|
||||||
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}|" \
|
||||||
-e "s|@@KEYMAP@@|${KEYMAP}|" \
|
-e "s|@@KEYMAP@@|${KEYMAP}|" \
|
||||||
-e "s|@@ARCH@@|$(uname -m)|" \
|
-e "s|@@ARCH@@|$(uname -m)|" \
|
||||||
-e "s|@@LOCALE@@|${LOCALE}|" $ISOLINUX_DIR/isolinux.cfg
|
-e "s|@@LOCALE@@|${LOCALE}|" $ISOLINUX_DIR/isolinux.cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_grub_efi_boot() {
|
generate_grub_efi_boot() {
|
||||||
@ -218,31 +216,31 @@ generate_grub_efi_boot() {
|
|||||||
cp -f $MKLIVE_DATADIR/grub_void.cfg.in \
|
cp -f $MKLIVE_DATADIR/grub_void.cfg.in \
|
||||||
$GRUB_DIR/grub_void.cfg || error_out $?
|
$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 || error_out $?
|
||||||
cp -f $GRUB_DATADIR/unicode.pf2 $GRUB_DIR/fonts || error_out $?
|
cp -f $GRUB_DATADIR/unicode.pf2 $GRUB_DIR/fonts || error_out $?
|
||||||
cp -f /boot/grub/locale/* $GRUB_DIR/locale || error_out $?
|
cp -f /boot/grub/locale/* $GRUB_DIR/locale || error_out $?
|
||||||
|
|
||||||
# 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 || error_out $?
|
>>$LOGFILE 2>&1 || error_out $?
|
||||||
mkfs.vfat -F12 -S 512 -n "grub_uefi" "$GRUB_DIR/efiboot.img" \
|
mkfs.vfat -F12 -S 512 -n "grub_uefi" "$GRUB_DIR/efiboot.img" \
|
||||||
>>$LOGFILE 2>&1 || error_out $?
|
>>$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 || error_out $?
|
>>$LOGFILE 2>&1 || error_out $?
|
||||||
|
|
||||||
mkdir -p "${GRUB_EFI_TMPDIR}/EFI/boot/" || error_out $?
|
mkdir -p "${GRUB_EFI_TMPDIR}/EFI/boot/" || error_out $?
|
||||||
cd "$BUILDDIR" || error_out $?
|
cd "$BUILDDIR" || error_out $?
|
||||||
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 || error_out $?
|
||||||
umount "$GRUB_EFI_TMPDIR" || error_out $?
|
umount "$GRUB_EFI_TMPDIR" || error_out $?
|
||||||
losetup --detach "${LOOP_DEVICE}" || error_out $?
|
losetup --detach "${LOOP_DEVICE}" || error_out $?
|
||||||
rm -rf $GRUB_EFI_TMPDIR || error_out $?
|
rm -rf $GRUB_EFI_TMPDIR || error_out $?
|
||||||
@ -253,7 +251,7 @@ 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 || error_out $?
|
>>$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" \
|
||||||
@ -266,7 +264,7 @@ generate_squashfs() {
|
|||||||
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 || error_out
|
||||||
chmod 444 "$BUILDDIR/LiveOS/squashfs.img" || error_out $?
|
chmod 444 "$BUILDDIR/LiveOS/squashfs.img" || error_out $?
|
||||||
# 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" || error_out $?
|
||||||
@ -274,103 +272,103 @@ generate_squashfs() {
|
|||||||
|
|
||||||
generate_iso_image() {
|
generate_iso_image() {
|
||||||
xorriso -as mkisofs \
|
xorriso -as mkisofs \
|
||||||
-iso-level 3 -rock -joliet \
|
-iso-level 3 -rock -joliet \
|
||||||
-max-iso9660-filenames -omit-period \
|
-max-iso9660-filenames -omit-period \
|
||||||
-omit-version-number -relaxed-filenames -allow-lowercase \
|
-omit-version-number -relaxed-filenames -allow-lowercase \
|
||||||
-volid "VOID_LIVE" \
|
-volid "VOID_LIVE" \
|
||||||
-eltorito-boot boot/isolinux/isolinux.bin \
|
-eltorito-boot boot/isolinux/isolinux.bin \
|
||||||
-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 /usr/share/syslinux/isohdpfx.bin \
|
||||||
-output "$OUTPUT_FILE" "$BUILDDIR" >>$LOGFILE 2>&1 || error_out $?
|
-output "$OUTPUT_FILE" "$BUILDDIR" >>$LOGFILE 2>&1 || error_out $?
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# main()
|
# main()
|
||||||
#
|
#
|
||||||
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))
|
||||||
|
|
||||||
# Set defaults
|
# Set defaults
|
||||||
if [ -z "$CONFIG_FILE" ]; then
|
if [ -z "$CONFIG_FILE" ]; then
|
||||||
CONFIG_FILE="$HOME/.mklive.conf"
|
CONFIG_FILE="$HOME/.mklive.conf"
|
||||||
fi
|
fi
|
||||||
LOGFILE="$(mktemp -t vmklive-XXXXXXXXXX.log)"
|
LOGFILE="$(mktemp -t vmklive-XXXXXXXXXX.log)"
|
||||||
|
|
||||||
if [ -z "$SYSLINUX_DATADIR" ]; then
|
if [ -z "$SYSLINUX_DATADIR" ]; then
|
||||||
SYSLINUX_DATADIR=/usr/share/syslinux
|
SYSLINUX_DATADIR=/usr/share/syslinux
|
||||||
fi
|
fi
|
||||||
if [ -z "$GRUB_DATADIR" ]; then
|
if [ -z "$GRUB_DATADIR" ]; then
|
||||||
GRUB_DATADIR=/usr/share/grub
|
GRUB_DATADIR=/usr/share/grub
|
||||||
fi
|
fi
|
||||||
if [ -z "$MKLIVE_DATADIR" ]; then
|
if [ -z "$MKLIVE_DATADIR" ]; then
|
||||||
MKLIVE_DATADIR=/usr/share/void-mklive
|
MKLIVE_DATADIR=/usr/share/void-mklive
|
||||||
fi
|
fi
|
||||||
if [ -z "$SPLASH_IMAGE" ]; then
|
if [ -z "$SPLASH_IMAGE" ]; then
|
||||||
SPLASH_IMAGE=/usr/share/void-artwork/splash.png
|
SPLASH_IMAGE=/usr/share/void-artwork/splash.png
|
||||||
fi
|
fi
|
||||||
if [ -z "$XBPS_INSTALL_CMD" ]; then
|
if [ -z "$XBPS_INSTALL_CMD" ]; then
|
||||||
XBPS_INSTALL_CMD=xbps-install
|
XBPS_INSTALL_CMD=xbps-install
|
||||||
fi
|
fi
|
||||||
if [ -z "$XBPS_REMOVE_CMD" ]; then
|
if [ -z "$XBPS_REMOVE_CMD" ]; then
|
||||||
XBPS_REMOVE_CMD=xbps-remove
|
XBPS_REMOVE_CMD=xbps-remove
|
||||||
fi
|
fi
|
||||||
if [ -z "$XBPS_QUERY_CMD" ]; then
|
if [ -z "$XBPS_QUERY_CMD" ]; then
|
||||||
XBPS_QUERY_CMD=xbps-query
|
XBPS_QUERY_CMD=xbps-query
|
||||||
fi
|
fi
|
||||||
if [ -z "$XBPS_RINDEX_CMD" ]; then
|
if [ -z "$XBPS_RINDEX_CMD" ]; then
|
||||||
XBPS_RINDEX_CMD=xbps-rindex
|
XBPS_RINDEX_CMD=xbps-rindex
|
||||||
fi
|
fi
|
||||||
if [ -z "$XBPS_UHELPER_CMD" ]; then
|
if [ -z "$XBPS_UHELPER_CMD" ]; then
|
||||||
XBPS_UHELPER_CMD=xbps-uhelper
|
XBPS_UHELPER_CMD=xbps-uhelper
|
||||||
fi
|
fi
|
||||||
if [ -z "$XBPS_RECONFIGURE_CMD" ]; then
|
if [ -z "$XBPS_RECONFIGURE_CMD" ]; then
|
||||||
XBPS_RECONFIGURE_CMD=xbps-reconfigure
|
XBPS_RECONFIGURE_CMD=xbps-reconfigure
|
||||||
fi
|
fi
|
||||||
if [ -z "$COMPRESSTYPE" ]; then
|
if [ -z "$COMPRESSTYPE" ]; then
|
||||||
COMPRESSTYPE=xz
|
COMPRESSTYPE=xz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create or read configuration file.
|
# Create or read configuration file.
|
||||||
if [ ! -r $CONFIG_FILE ]; then
|
if [ ! -r $CONFIG_FILE ]; then
|
||||||
info_msg "Creating config file at $CONFIG_FILE."
|
info_msg "Creating config file at $CONFIG_FILE."
|
||||||
write_conf_file $CONFIG_FILE
|
write_conf_file $CONFIG_FILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. $CONFIG_FILE
|
. $CONFIG_FILE
|
||||||
|
|
||||||
if [ -z "$PACKAGE_LIST" ]; then
|
if [ -z "$PACKAGE_LIST" ]; then
|
||||||
PACKAGE_LIST="base-system-live"
|
PACKAGE_LIST="base-system-live"
|
||||||
else
|
else
|
||||||
PACKAGE_LIST="base-system-live $PACKAGE_LIST"
|
PACKAGE_LIST="base-system-live $PACKAGE_LIST"
|
||||||
fi
|
fi
|
||||||
if [ ! -f $SYSLINUX_DATADIR/isolinux.bin ]; then
|
if [ ! -f $SYSLINUX_DATADIR/isolinux.bin ]; then
|
||||||
echo "Missing required isolinux files in $SYSLINUX_DATADIR, exiting..."
|
echo "Missing required isolinux files in $SYSLINUX_DATADIR, exiting..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for root permissions.
|
# Check for root permissions.
|
||||||
if [ "$(id -u)" -ne 0 ]; then
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
echo "Must be run as root, exiting..."
|
echo "Must be run as root, exiting..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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) || exit 1
|
||||||
else
|
else
|
||||||
BUILDDIR=$(mktemp --tmpdir="$(pwd -P)" -d) || exit 1
|
BUILDDIR=$(mktemp --tmpdir="$(pwd -P)" -d) || exit 1
|
||||||
fi
|
fi
|
||||||
BUILDDIR=$(readlink -f $BUILDDIR)
|
BUILDDIR=$(readlink -f $BUILDDIR)
|
||||||
ROOTFS="$BUILDDIR/rootfs"
|
ROOTFS="$BUILDDIR/rootfs"
|
||||||
@ -385,25 +383,25 @@ mkdir -p $ISOLINUX_DIR $GRUB_DIR
|
|||||||
#
|
#
|
||||||
${XBPS_QUERY_CMD} -L >/dev/null 2>&1
|
${XBPS_QUERY_CMD} -L >/dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "No repositories available, exiting..."
|
echo "No repositories available, exiting..."
|
||||||
error_out
|
error_out
|
||||||
fi
|
fi
|
||||||
|
|
||||||
XBPS_ARGS="-r $ROOTFS -y"
|
XBPS_ARGS="-r $ROOTFS -y"
|
||||||
if [ -n "$REPOSITORY_CACHE" ]; then
|
if [ -n "$REPOSITORY_CACHE" ]; then
|
||||||
XBPS_ARGS="$XBPS_ARGS -c $REPOSITORY_CACHE"
|
XBPS_ARGS="$XBPS_ARGS -c $REPOSITORY_CACHE"
|
||||||
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.18
|
||||||
[0-9].[1-9][8-9]*) ;;
|
[0-9].[1-9][8-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.18 is required." && exit 1;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
KERNELVERSION=$($XBPS_QUERY_CMD -R --property version kernel)
|
KERNELVERSION=$($XBPS_QUERY_CMD -R --property version kernel)
|
||||||
|
|
||||||
if [ -z "$OUTPUT_FILE" ]; then
|
if [ -z "$OUTPUT_FILE" ]; then
|
||||||
OUTPUT_FILE="$HOME/void-live-$(uname -m)-${KERNELVERSION}-$(date +%Y%m%d).iso"
|
OUTPUT_FILE="$HOME/void-live-$(uname -m)-${KERNELVERSION}-$(date +%Y%m%d).iso"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info_msg "Redirecting stdout/stderr to $LOGFILE ..."
|
info_msg "Redirecting stdout/stderr to $LOGFILE ..."
|
||||||
@ -435,11 +433,11 @@ copy_kernel_and_modules
|
|||||||
# Generate the package local repository for void-installer.
|
# Generate the package local repository for void-installer.
|
||||||
#
|
#
|
||||||
if [ -z "$LOCALREPO_PKGLIST" ]; then
|
if [ -z "$LOCALREPO_PKGLIST" ]; then
|
||||||
_skip="(disabled)"
|
_skip="(disabled)"
|
||||||
fi
|
fi
|
||||||
info_msg "[4/9] Generating package local repository ${_skip}..."
|
info_msg "[4/9] Generating package local repository ${_skip}..."
|
||||||
if [ -n "$LOCALREPO_PKGLIST" ]; then
|
if [ -n "$LOCALREPO_PKGLIST" ]; then
|
||||||
generate_local_repository
|
generate_local_repository
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
# Generate the isolinux boot.
|
# Generate the isolinux boot.
|
||||||
@ -472,3 +470,5 @@ 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."
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
# vim: set ts=4 sw=4 et:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user