2011-07-17 01:23:00 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2012-02-04 18:11:26 +01:00
|
|
|
# Public Domain, 2009-2012 - Juan RP <xtraeme@gmail.com>
|
2011-07-17 01:23:00 +02:00
|
|
|
#
|
|
|
|
trap "echo; error_out $?" INT QUIT
|
|
|
|
|
|
|
|
info_msg()
|
|
|
|
{
|
|
|
|
printf "\033[1m$@\n\033[m"
|
|
|
|
}
|
|
|
|
|
|
|
|
mount_pseudofs()
|
|
|
|
{
|
|
|
|
local fs
|
|
|
|
|
|
|
|
if [ -n "$ROOTDIR" ]; then
|
|
|
|
mount --bind "$ROOTDIR" "$ROOTFS" || error_out $?
|
|
|
|
fi
|
|
|
|
|
|
|
|
for fs in sys proc dev; do
|
|
|
|
if [ ! -d "$ROOTFS/$fs" ]; then
|
|
|
|
mkdir -p "$ROOTFS/$fs"
|
|
|
|
fi
|
|
|
|
mount --bind /$fs "$ROOTFS/$fs" || error_out $?
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
umount_pseudofs()
|
|
|
|
{
|
|
|
|
local fs
|
|
|
|
|
|
|
|
for fs in sys proc dev; do
|
|
|
|
umount -f "$ROOTFS/$fs" >/dev/null 2>&1
|
|
|
|
done
|
|
|
|
if [ -n "$1" -a -n "$ROOTDIR" ]; then
|
|
|
|
umount -f "$ROOTFS" >/dev/null 2>&1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
error_out()
|
|
|
|
{
|
|
|
|
umount_pseudofs
|
|
|
|
|
2012-02-04 18:11:26 +01:00
|
|
|
info_msg "There was an error! cleaning up $BUILDDIR, exiting..."
|
|
|
|
|
|
|
|
[ -d "$BUILDDIR" ] && rm -rf "$BUILDDIR"
|
|
|
|
[ -f "$LOGFILE" ] && rm -f "$LOGFILE"
|
|
|
|
|
2011-07-17 01:23:00 +02:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
write_etc_motd()
|
|
|
|
{
|
|
|
|
cat >> "$ROOTFS/etc/motd" <<_EOF
|
|
|
|
###############################################################################
|
2012-05-29 11:54:29 +02:00
|
|
|
Autogenerated by vmklive @@MKLIVE_VERSION@@
|
2011-07-17 01:23:00 +02:00
|
|
|
-------------------------------------------------------------------------------
|
|
|
|
|
2012-02-04 18:11:26 +01:00
|
|
|
Welcome to the Void Linux Live system, you have been autologged in.
|
2011-07-17 01:23:00 +02:00
|
|
|
This user has full sudo(8) permissions without any password, be careful
|
|
|
|
executing commands through sudo(8).
|
|
|
|
|
|
|
|
To play with package management use the xbps-bin(8) and xbps-repo(8)
|
|
|
|
utilities. Please visit:
|
|
|
|
|
|
|
|
http://code.google.com/p/xbps/
|
|
|
|
|
2011-07-29 09:39:30 +02:00
|
|
|
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.
|
2011-07-17 01:23:00 +02:00
|
|
|
|
2012-02-05 22:17:57 +01:00
|
|
|
To start the installation please type:
|
|
|
|
|
|
|
|
$ sudo void-installer
|
|
|
|
|
|
|
|
and follow the on-screen instructions. Thanks for trying Void Linux.
|
2012-02-04 18:11:26 +01:00
|
|
|
|
2011-07-17 01:23:00 +02:00
|
|
|
###############################################################################
|
|
|
|
_EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
write_default_isolinux_conf()
|
|
|
|
{
|
|
|
|
local kver="$1"
|
|
|
|
|
|
|
|
if [ -r "$SPLASH_IMAGE" ]; then
|
|
|
|
BACKGROUND="MENU BACKGROUND $(basename $SPLASH_IMAGE)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cat >> "$ISOLINUX_CFG" << _EOF
|
2011-10-18 13:10:31 +02:00
|
|
|
UI vesamenu.c32
|
2011-07-17 01:23:00 +02:00
|
|
|
PROMPT 0
|
|
|
|
TIMEOUT 100
|
|
|
|
ONTIMEOUT linux
|
|
|
|
|
|
|
|
MENU TABMSG Press ENTER to boot or TAB to edit a menu entry
|
|
|
|
MENU AUTOBOOT BIOS default device boot in # second{,s}...
|
2011-10-18 13:10:31 +02:00
|
|
|
$BACKGROUND
|
|
|
|
MENU WIDTH 78
|
|
|
|
MENU MARGIN 1
|
|
|
|
MENU ROWS 4
|
|
|
|
MENU VSHIFT 2
|
|
|
|
MENU TIMEOUTROW 8
|
|
|
|
MENU TABMSGROW 2
|
|
|
|
MENU CMDLINEROW 11
|
|
|
|
MENU HELPMSGROW 16
|
|
|
|
MENU HELPMSGENDROW 29
|
2011-07-17 01:23:00 +02:00
|
|
|
|
|
|
|
MENU COLOR title * #FF5255FF *
|
|
|
|
MENU COLOR border * #00000000 #00000000 none
|
|
|
|
MENU COLOR sel * #ffffffff #FF5255FF *
|
|
|
|
|
|
|
|
LABEL linux
|
|
|
|
MENU LABEL Boot Void GNU/Linux ${kver} ($(uname -m))
|
2012-05-29 11:54:29 +02:00
|
|
|
KERNEL vmlinuz
|
|
|
|
APPEND initrd=initrd.lz root=live:CDLABEL=VoidLinux-live-$(uname -m)-${kver} \
|
|
|
|
rootfstype=auto ro liveimg rd.luks=0 rd.md=0 rd.dm=0 \
|
|
|
|
vconsole.keymap=${KEYMAP} vconsole.unicode=1 locale.LANG=${LOCALE}
|
2011-07-17 01:23:00 +02:00
|
|
|
LABEL c
|
2012-05-29 11:54:29 +02:00
|
|
|
MENU LABEL Boot first HD found by BIOS
|
2011-07-17 01:23:00 +02:00
|
|
|
LOCALBOOT 0x80
|
|
|
|
_EOF
|
|
|
|
}
|
|
|
|
|
2012-02-04 18:11:26 +01:00
|
|
|
write_conf_file()
|
|
|
|
{
|
|
|
|
cat > "$1" <<_EOF
|
|
|
|
# *-*- sh -*-*
|
|
|
|
# Default configuration file for vmklive-@VERSION@.
|
|
|
|
#
|
|
|
|
# List of packages to be installed into the live image.
|
|
|
|
# At least 'base-system' or 'base-system-live' is required.
|
|
|
|
PACKAGE_LIST="base-system-live"
|
|
|
|
|
|
|
|
# Syslinux splash image.
|
|
|
|
SPLASH_IMAGE=/usr/share/void-artwork/splash.png
|
|
|
|
|
|
|
|
# Default keymap to use.
|
|
|
|
KEYMAP=us
|
|
|
|
|
|
|
|
# Default locale to use.
|
2012-05-29 11:54:29 +02:00
|
|
|
LOCALE=en_US
|
2012-02-04 18:11:26 +01:00
|
|
|
|
|
|
|
# Path to XBPS utilities.
|
|
|
|
#XBPS_BIN_CMD=xbps-bin
|
|
|
|
#XBPS_REPO_CMD=xbps-repo
|
|
|
|
#XBPS_UHELPER_CMD=xbps-uhelper
|
|
|
|
|
|
|
|
# XBPS cache directory to install packages from.
|
|
|
|
#REPOSITORY_CACHE=/blah/foo
|
|
|
|
|
|
|
|
_EOF
|
|
|
|
chmod 644 "$1"
|
|
|
|
}
|
|
|
|
|
2011-07-17 01:23:00 +02:00
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat <<_EOF
|
2012-05-29 11:54:29 +02:00
|
|
|
Usage: $(basename $0) [options]
|
2011-07-17 01:23:00 +02:00
|
|
|
|
|
|
|
Options:
|
2012-02-04 18:11:26 +01:00
|
|
|
-C file Path to configuration file (defaults to ~/.mklive.conf)
|
|
|
|
-c (gzip|bzip2|xz) Compression type for the squashfs/initramfs image.
|
2012-05-29 11:54:29 +02:00
|
|
|
-k version Kernel version to use.
|
2012-02-04 18:11:26 +01:00
|
|
|
-o outfile Output file name for the ISO image.
|
|
|
|
-r rootdir Rootfs directory.
|
|
|
|
-s splash Splash image file for isolinux.
|
|
|
|
-v volname ISO Volume name.
|
2011-07-17 01:23:00 +02:00
|
|
|
_EOF
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# main()
|
|
|
|
#
|
2012-05-29 11:54:29 +02:00
|
|
|
while getopts "C:c:k:o:r:s:v:" opt; do
|
2011-07-17 01:23:00 +02:00
|
|
|
case $opt in
|
2012-02-04 18:11:26 +01:00
|
|
|
C) CONFIG_FILE="$OPTARG";;
|
|
|
|
c) COMPRESSTYPE="$OPTARG";;
|
2012-05-29 11:54:29 +02:00
|
|
|
k) KERNELVERSION="$OPTARG";;
|
2012-02-04 18:11:26 +01:00
|
|
|
o) OUTPUT_FILE="$OPTARG";;
|
|
|
|
r) ROOTDIR="$OPTARG";;
|
|
|
|
s) SPLASH_IMAGE="$OPTARG";;
|
|
|
|
v) ISO_VOLUME="$OPTARG";;
|
2011-07-17 01:23:00 +02:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $(($OPTIND - 1))
|
|
|
|
|
2012-02-04 18:11:26 +01:00
|
|
|
if [ -z "$KERNELVERSION" ]; then
|
2012-05-29 11:54:29 +02:00
|
|
|
KERNELVERSION="$(uname -r)"
|
2012-02-04 18:11:26 +01:00
|
|
|
fi
|
2011-07-17 01:23:00 +02:00
|
|
|
|
2012-02-04 18:11:26 +01:00
|
|
|
# Set defaults
|
|
|
|
if [ -z "$CONFIG_FILE" ]; then
|
|
|
|
CONFIG_FILE="$HOME/.mklive.conf"
|
|
|
|
fi
|
2011-07-17 01:23:00 +02:00
|
|
|
if [ -z "$OUTPUT_FILE" ]; then
|
2012-02-04 18:11:26 +01:00
|
|
|
OUTPUT_FILE="$HOME/void-live-$(uname -m)-${KERNELVERSION}-$(date +%Y%m%d).iso"
|
2011-07-17 01:23:00 +02:00
|
|
|
fi
|
2012-02-04 18:11:26 +01:00
|
|
|
LOGFILE="$(mktemp -t vmklive-XXXXXXXXXX.log)"
|
|
|
|
|
2011-07-17 01:23:00 +02:00
|
|
|
if [ -z "$ISO_VOLUME" ]; then
|
2012-05-29 11:54:29 +02:00
|
|
|
ISO_VOLUME="VoidLinux-live-$(uname -m)-${KERNELVERSION}"
|
2012-02-04 18:11:26 +01:00
|
|
|
fi
|
|
|
|
if [ -z "$SYSLINUX_DATADIR" ]; then
|
|
|
|
SYSLINUX_DATADIR=/usr/share/syslinux
|
|
|
|
fi
|
|
|
|
if [ -z "$SPLASH_IMAGE" ]; then
|
|
|
|
SPLASH_IMAGE=/usr/share/void-artwork/splash.png
|
|
|
|
fi
|
|
|
|
if [ -z "$XBPS_REPO_CMD" ]; then
|
|
|
|
XBPS_REPO_CMD=xbps-repo
|
|
|
|
fi
|
|
|
|
if [ -z "$XBPS_BIN_CMD" ]; then
|
|
|
|
XBPS_BIN_CMD=xbps-bin
|
|
|
|
fi
|
|
|
|
if [ -z "$XBPS_UHELPER_CMD" ]; then
|
|
|
|
XBPS_UHELPER_CMD=xbps-uhelper
|
|
|
|
fi
|
|
|
|
if [ -z "$COMPRESSTYPE" ]; then
|
|
|
|
COMPRESSTYPE=xz
|
2011-07-17 01:23:00 +02:00
|
|
|
fi
|
|
|
|
|
2012-02-04 18:11:26 +01:00
|
|
|
# Create or read configuration file.
|
2011-07-17 01:23:00 +02:00
|
|
|
if [ ! -r $CONFIG_FILE ]; then
|
2012-02-04 18:11:26 +01:00
|
|
|
info_msg "Creating config file at $CONFIG_FILE."
|
|
|
|
write_conf_file $CONFIG_FILE
|
2011-07-17 01:23:00 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
. $CONFIG_FILE
|
|
|
|
|
|
|
|
if [ -z "$PACKAGE_LIST" ]; then
|
2012-02-04 18:11:26 +01:00
|
|
|
PACKAGE_LIST="base-system-live"
|
2011-07-17 01:23:00 +02:00
|
|
|
else
|
2012-02-04 18:11:26 +01:00
|
|
|
PACKAGE_LIST="base-system-live $PACKAGE_LIST"
|
2011-07-17 01:23:00 +02:00
|
|
|
fi
|
2012-02-04 18:11:26 +01:00
|
|
|
BUILDDIR=$(mktemp --tmpdir=$HOME -d) || exit 1
|
2011-07-17 01:23:00 +02:00
|
|
|
BUILDDIR=$(readlink -f $BUILDDIR)
|
2012-05-29 11:54:29 +02:00
|
|
|
ROOTFS="$BUILDDIR/rootfs"
|
2011-07-17 01:23:00 +02:00
|
|
|
ISOLINUX_DIR="$BUILDDIR/isolinux"
|
|
|
|
ISOLINUX_CFG="$ISOLINUX_DIR/isolinux.cfg"
|
|
|
|
|
|
|
|
if [ ! -f $SYSLINUX_DATADIR/isolinux.bin ]; then
|
2012-02-04 18:11:26 +01:00
|
|
|
echo "Missing required isolinux files in $SYSLINUX_DATADIR, exiting..."
|
|
|
|
error_out
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check for root permissions.
|
|
|
|
if [ "$(id -u)" -ne 0 ]; then
|
|
|
|
echo "Must be run as root, exiting..."
|
2011-07-17 01:23:00 +02:00
|
|
|
error_out
|
|
|
|
fi
|
|
|
|
|
2012-02-07 03:41:41 +01:00
|
|
|
#
|
|
|
|
# Check there are repos registered before anything.
|
|
|
|
#
|
|
|
|
${XBPS_REPO_CMD} list >/dev/null 2>&1
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "No repositories available, exiting..."
|
|
|
|
error_out
|
|
|
|
fi
|
|
|
|
|
2011-07-17 01:23:00 +02:00
|
|
|
#
|
|
|
|
# Mount pseudofs in the target rootfs.
|
|
|
|
#
|
|
|
|
mount_pseudofs
|
|
|
|
mkdir -p "$ROOTFS/tmp"
|
2012-05-29 11:54:29 +02:00
|
|
|
mkdir -p "$ISOLINUX_DIR"
|
2011-07-17 01:23:00 +02:00
|
|
|
|
2012-02-04 18:11:26 +01:00
|
|
|
XBPS_ARGS="-r $ROOTFS -y"
|
|
|
|
if [ -n "$REPOSITORY_CACHE" ]; then
|
|
|
|
XBPS_ARGS="$XBPS_ARGS -c $REPOSITORY_CACHE"
|
|
|
|
fi
|
|
|
|
XBPS_VERSION=$($XBPS_BIN_CMD -V|awk '{print $2}')
|
|
|
|
case $XBPS_VERSION in
|
|
|
|
# XBPS >= 0.12
|
|
|
|
[0-9].[1-9][2-9]*);;
|
|
|
|
# XBPS < 0.12
|
|
|
|
*) purge_flag="-p" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
info_msg "Redirecting stdout/stderr to $LOGFILE..."
|
|
|
|
info_msg "[1/9] Installing packages into the rootfs..."
|
|
|
|
for f in ${PACKAGE_LIST}; do
|
|
|
|
info_msg " $f"
|
|
|
|
done
|
2011-07-17 01:23:00 +02:00
|
|
|
if [ -z "$ROOTDIR" ]; then
|
2012-02-07 03:41:41 +01:00
|
|
|
# Check that all pkgs are reachable.
|
|
|
|
${XBPS_BIN_CMD} ${XBPS_ARGS} -n install ${PACKAGE_LIST} >>$LOGFILE 2>&1
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
info_msg "Missing required binary packages, exiting..."
|
|
|
|
error_out
|
|
|
|
fi
|
2012-02-04 18:11:26 +01:00
|
|
|
${XBPS_BIN_CMD} ${XBPS_ARGS} install ${PACKAGE_LIST} \
|
|
|
|
2>&1|cat >> $LOGFILE || error_out
|
|
|
|
${XBPS_BIN_CMD} ${XBPS_ARGS} autoupdate \
|
|
|
|
2>&1|cat >> $LOGFILE || error_out
|
|
|
|
${XBPS_BIN_CMD} ${XBPS_ARGS} ${purge_flag} autoremove \
|
|
|
|
2>&1|cat >> $LOGFILE || error_out
|
2011-07-17 01:23:00 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
${XBPS_BIN_CMD} -r "$ROOTFS" list > \
|
2012-02-04 18:11:26 +01:00
|
|
|
"${OUTPUT_FILE%.iso}"-package-list.txt || error_out
|
2011-07-17 01:23:00 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Prepare /etc/motd.
|
|
|
|
#
|
2012-02-04 18:11:26 +01:00
|
|
|
info_msg "[2/9] Creating /etc/motd..."
|
2012-02-07 02:48:43 +01:00
|
|
|
mkdir -p "$ROOTFS"/etc
|
2011-07-17 01:23:00 +02:00
|
|
|
write_etc_motd
|
|
|
|
|
|
|
|
#
|
2012-02-04 18:11:26 +01:00
|
|
|
# Create the initramfs with XZ compression.
|
2011-07-17 01:23:00 +02:00
|
|
|
#
|
2012-02-04 18:11:26 +01:00
|
|
|
info_msg "[3/9] Creating initramfs image ($COMPRESSTYPE)..."
|
2012-05-29 11:54:29 +02:00
|
|
|
dracut --add "dmsquash-live vmklive" --${COMPRESSTYPE} \
|
|
|
|
"${ISOLINUX_DIR}/initrd.lz" ${KERNELVERSION} 2>/dev/null || error_out
|
2011-07-17 01:23:00 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Copy the linux image to the target directory.
|
|
|
|
#
|
2012-02-04 18:11:26 +01:00
|
|
|
info_msg "[4/9] Copying kernel image/modules..."
|
2012-05-29 11:54:29 +02:00
|
|
|
cp -f /boot/vmlinuz-${KERNELVERSION} "${ISOLINUX_DIR}/vmlinuz" || error_out $?
|
2012-02-04 18:11:26 +01:00
|
|
|
mkdir -p "$ROOTFS/lib/modules"
|
|
|
|
cp -a /lib/modules/${KERNELVERSION} "$ROOTFS/lib/modules" || error_out $?
|
|
|
|
|
2012-02-05 22:17:57 +01:00
|
|
|
# Generate a sane xbps.conf for the rootfs.
|
|
|
|
rm -f $ROOTFS/etc/xbps/xbps.conf
|
2012-05-29 11:54:29 +02:00
|
|
|
echo "# xbps.conf generated by vmklive-0.8.5" \
|
2012-02-05 22:17:57 +01:00
|
|
|
> $ROOTFS/etc/xbps/xbps.conf
|
|
|
|
echo "TransactionFrequencyFlush = 0" \
|
2012-02-06 15:45:58 +01:00
|
|
|
>> $ROOTFS/etc/xbps/xbps.conf
|
2012-02-05 22:17:57 +01:00
|
|
|
echo "virtual-package rsyslog { targets = syslog-daemon-0 }" \
|
|
|
|
>> $ROOTFS/etc/xbps/xbps.conf
|
|
|
|
echo "virtual-package dcron { targets = cron-daemon-0 }" \
|
|
|
|
>> $ROOTFS/etc/xbps/xbps.conf
|
2012-05-29 16:13:05 +02:00
|
|
|
echo "virtual-package kmod { targets = module-init-tools-3.17 }" \
|
|
|
|
>> $ROOTFS/etc/xbps/xbps.conf
|
2012-02-05 22:17:57 +01:00
|
|
|
_devel=$($XBPS_UHELPER_CMD -r $ROOTFS version xbps-devel)
|
|
|
|
if [ -n "${_devel}" ]; then
|
|
|
|
echo "virtual-package xbps-devel { targets = xbps-9999 }" \
|
|
|
|
>> $ROOTFS/etc/xbps/xbps.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Generate a conf for local repositories.
|
|
|
|
cat > $ROOTFS/etc/xbps/local-repos.conf <<_EOF
|
|
|
|
repositories = {
|
|
|
|
/packages/noarch,
|
|
|
|
/packages/i686,
|
|
|
|
/packages/x86_64
|
|
|
|
}
|
|
|
|
_EOF
|
|
|
|
# Generate a conf for remote repositories.
|
|
|
|
cat > $ROOTFS/etc/xbps/network-repos.conf <<_EOF
|
|
|
|
repositories = {
|
|
|
|
http://xbps.goodluckwith.us/binpkgs/i686,
|
|
|
|
http://xbps.goodluckwith.us/binpkgs/noarch,
|
|
|
|
http://xbps.goodluckwith.us/binpkgs/nonfree/i686,
|
|
|
|
http://xbps.nopcode.org/repos/current/x86_64,
|
|
|
|
http://xbps.nopcode.org/repos/current/noarch,
|
|
|
|
http://xbps.nopcode.org/repos/current/nonfree/x86_64
|
|
|
|
}
|
|
|
|
_EOF
|
|
|
|
chmod 644 $ROOTFS/etc/xbps/*.conf || error_out $?
|
|
|
|
|
|
|
|
# Create local repos for base-system and grub packages required by
|
|
|
|
# the void-installer pkg.
|
|
|
|
ROOTFS_REPODIR=$ROOTFS/packages
|
|
|
|
mkdir -p $ROOTFS_REPODIR
|
|
|
|
pkgs=$($XBPS_BIN_CMD -r /tmp/blah -n install base-system grub)
|
|
|
|
set -- ${pkgs}
|
|
|
|
while [ $# -ne 0 ]; do
|
|
|
|
pkgn=$1; action=$2; ver=$3; repo=$4; binpkg=$5
|
|
|
|
shift 5
|
|
|
|
repodir=$(basename $repo)
|
|
|
|
[ ! -d $ROOTFS_REPODIR/$repodir ] && mkdir $ROOTFS_REPODIR/$repodir
|
|
|
|
bpkg=$repo/$binpkg
|
|
|
|
cp -f $bpkg $ROOTFS_REPODIR/$repodir
|
|
|
|
done
|
|
|
|
for f in $ROOTFS_REPODIR/*; do
|
|
|
|
${XBPS_REPO_CMD} genindex $f 2>&1 >>$LOGFILE
|
|
|
|
# remove rindex-files.plist, unneeded.
|
|
|
|
rm -f $f/rindex-files.plist
|
|
|
|
done
|
|
|
|
|
2012-05-29 14:11:27 +02:00
|
|
|
# install lsblk and blkid from util-linux. to avoid installing
|
|
|
|
# the whole package.
|
|
|
|
_lsblk=$(which lsblk)
|
|
|
|
_blkid=$(which blkid)
|
|
|
|
install -Dm755 ${_lsblk} "$ROOTFS/usr/bin/lsblk" || error_out $?
|
|
|
|
install -Dm755 ${_blkid} "$ROOTFS/sbin/blkid" || error_out $?
|
|
|
|
|
2011-07-17 01:23:00 +02:00
|
|
|
#
|
|
|
|
# The pseudofs aren't needed anymore in target rootfs.
|
|
|
|
#
|
|
|
|
umount_pseudofs
|
|
|
|
|
|
|
|
#
|
|
|
|
# Copy required isolinux files in the target rootfs.
|
|
|
|
#
|
2012-02-04 18:11:26 +01:00
|
|
|
info_msg "[5/9] Copying isolinux files..."
|
2011-07-17 01:23:00 +02:00
|
|
|
cp -f $SYSLINUX_DATADIR/isolinux.bin "$ISOLINUX_DIR"
|
|
|
|
cp -f $SYSLINUX_DATADIR/vesamenu.c32 "$ISOLINUX_DIR"
|
2012-03-09 09:08:41 +01:00
|
|
|
write_default_isolinux_conf ${KERNELVERSION}
|
2011-07-17 01:23:00 +02:00
|
|
|
if [ -f "$SPLASH_IMAGE" ]; then
|
|
|
|
cp -f $SPLASH_IMAGE "$ISOLINUX_DIR"
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Prepare the squashed rootfs image.
|
|
|
|
#
|
2012-02-04 18:11:26 +01:00
|
|
|
info_msg "[6/9] Creating squashfs image ($COMPRESSTYPE) from rootfs..."
|
2012-05-29 11:54:29 +02:00
|
|
|
# Find out required size for the rootfs and create an ext3fs image off it.
|
|
|
|
ROOTFS_SIZE=$(du -sk "$ROOTFS"|awk '{print $1}')
|
|
|
|
mkdir -p "$BUILDDIR/tmp/LiveOS"
|
|
|
|
dd if=/dev/zero of="$BUILDDIR/tmp/LiveOS/ext3fs.img" \
|
|
|
|
bs="$((${ROOTFS_SIZE}+($ROOTFS_SIZE/6)))K" count=1 2>&1 | cat >>$LOGFILE || error_out $?
|
|
|
|
mkdir -p "$BUILDDIR/tmp-rootfs"
|
|
|
|
mkfs.ext3 -F -m1 "$BUILDDIR/tmp/LiveOS/ext3fs.img" 2>&1 | cat >>$LOGFILE || error_out $?
|
|
|
|
mount -o loop "$BUILDDIR/tmp/LiveOS/ext3fs.img" "$BUILDDIR/tmp-rootfs" || error_out $?
|
|
|
|
cd $BUILDDIR
|
|
|
|
cp -a rootfs/* tmp-rootfs/
|
|
|
|
umount -f "$BUILDDIR/tmp-rootfs"
|
|
|
|
mkdir -p "$BUILDDIR/LiveOS"
|
|
|
|
|
|
|
|
mksquashfs "$BUILDDIR/tmp" "$BUILDDIR/LiveOS/squashfs.img" \
|
|
|
|
-comp ${COMPRESSTYPE} 2>&1 | cat >> $LOGFILE || error_out
|
|
|
|
chmod 444 "$BUILDDIR/LiveOS/squashfs.img" || error_out $?
|
|
|
|
|
|
|
|
info_msg "[7/9] Removing rootfs directory..."
|
|
|
|
rm -rf "$ROOTFS" "$BUILDDIR/tmp-rootfs" "$BUILDDIR/tmp" || error_out $?
|
2011-07-17 01:23:00 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Prepare the ISO image.
|
|
|
|
#
|
2012-02-04 18:11:26 +01:00
|
|
|
info_msg "[8/9] Building ISO image..."
|
2011-07-17 01:23:00 +02:00
|
|
|
mkisofs -J -r -V "$ISO_VOLUME" -b isolinux/isolinux.bin \
|
|
|
|
-c isolinux/boot.cat -no-emul-boot \
|
|
|
|
-boot-load-size 4 -boot-info-table \
|
2012-02-04 18:11:26 +01:00
|
|
|
-o "$OUTPUT_FILE" "$BUILDDIR" 2>&1 | cat >>$LOGFILE || error_out $?
|
2011-07-17 01:23:00 +02:00
|
|
|
|
2012-02-04 18:11:26 +01:00
|
|
|
info_msg "[9/9] Removing build directory..."
|
2011-07-17 01:23:00 +02:00
|
|
|
rm -rf "$BUILDDIR" || error_out $?
|
|
|
|
|
2012-02-04 18:11:26 +01:00
|
|
|
hsize=$(du -sh "$OUTPUT_FILE"|awk '{print $1}')
|
|
|
|
info_msg "Created $(readlink -f $OUTPUT_FILE) ($hsize) successfully."
|
2011-07-17 01:23:00 +02:00
|
|
|
|
|
|
|
exit 0
|