Refactor commands out into functions (for the future)
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
This commit is contained in:
parent
6f9cdf5958
commit
b7d7a9fcdf
1 changed files with 18 additions and 9 deletions
|
@ -111,9 +111,8 @@ install_pkgfile ()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Go through the main commands in order. If 'all' was specified, then we want
|
|
||||||
# to do everything. Start with 'install'.
|
command_install () {
|
||||||
if [ "${command_name}" = "install" -o "${command_name}" = "all" ]; then
|
|
||||||
echo "====> Installing/building image root"
|
echo "====> Installing/building image root"
|
||||||
if [ -e "${work_dir}" -a "${FORCE}" = "n" ]; then
|
if [ -e "${work_dir}" -a "${FORCE}" = "n" ]; then
|
||||||
echo "error: Working dir '${work_dir}' already exists, aborting."
|
echo "error: Working dir '${work_dir}' already exists, aborting."
|
||||||
|
@ -177,10 +176,9 @@ if [ "${command_name}" = "install" -o "${command_name}" = "all" ]; then
|
||||||
else
|
else
|
||||||
mksquashfs "${DEF_CONFIG_DIR}" "${imgroot}/addons/overlay.sqfs" -noappend
|
mksquashfs "${DEF_CONFIG_DIR}" "${imgroot}/addons/overlay.sqfs" -noappend
|
||||||
fi
|
fi
|
||||||
fi
|
}
|
||||||
|
|
||||||
# Squash is the next step.
|
command_squash () {
|
||||||
if [ "${command_name}" = "squash" -o "${command_name}" = "all" ]; then
|
|
||||||
echo "====> Generating SquashFS image"
|
echo "====> Generating SquashFS image"
|
||||||
imagename="${imgroot}/archlive.sqfs"
|
imagename="${imgroot}/archlive.sqfs"
|
||||||
if [ -e "${imagename}" ]; then
|
if [ -e "${imagename}" ]; then
|
||||||
|
@ -203,10 +201,9 @@ if [ "${command_name}" = "squash" -o "${command_name}" = "all" ]; then
|
||||||
fi
|
fi
|
||||||
minutes=$(echo $start $(date +%s) | awk '{ printf "%0.2f",($2-$1)/60 }')
|
minutes=$(echo $start $(date +%s) | awk '{ printf "%0.2f",($2-$1)/60 }')
|
||||||
echo "Image creation done in $minutes minutes."
|
echo "Image creation done in $minutes minutes."
|
||||||
fi
|
}
|
||||||
|
|
||||||
# Finally, make the image.
|
command_img () {
|
||||||
if [ "${command_name}" = "img" -o "${command_name}" = "all" ]; then
|
|
||||||
echo "====> Making bootable image"
|
echo "====> Making bootable image"
|
||||||
[ "x${imgname}" = "x" ] && (echo "Bootable image name must be specified" && usage 1)
|
[ "x${imgname}" = "x" ] && (echo "Bootable image name must be specified" && usage 1)
|
||||||
if [ -e "${imgname}" ]; then
|
if [ -e "${imgname}" ]; then
|
||||||
|
@ -255,6 +252,18 @@ if [ "${command_name}" = "img" -o "${command_name}" = "all" ]; then
|
||||||
-A "Arch Linux Live/Rescue CD" \
|
-A "Arch Linux Live/Rescue CD" \
|
||||||
-o "${imgname}" "${imgroot}"
|
-o "${imgname}" "${imgroot}"
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Go through the main commands in order. If 'all' was specified, then we want
|
||||||
|
# to do everything. Start with 'install'.
|
||||||
|
if [ "${command_name}" = "install" -o "${command_name}" = "all" ]; then
|
||||||
|
command_install
|
||||||
|
fi
|
||||||
|
if [ "${command_name}" = "squash" -o "${command_name}" = "all" ]; then
|
||||||
|
command_squash
|
||||||
|
fi
|
||||||
|
if [ "${command_name}" = "img" -o "${command_name}" = "all" ]; then
|
||||||
|
command_img
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# vim:ts=4:sw=4:et:
|
# vim:ts=4:sw=4:et:
|
||||||
|
|
Loading…
Add table
Reference in a new issue