2024-04-01 07:39:37 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# helps build a quick live image. that way a user doesn't have to use emapandas
|
|
|
|
# nor livemedia-creator. mock is probably not necessary, but it's up to you.
|
|
|
|
# label@resf.org
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
SCRNAME="$(basename "$0")"
|
|
|
|
SCRDIR="$(dirname "${BASH_SOURCE[0]}")"
|
|
|
|
|
|
|
|
export __usage
|
|
|
|
__usage="
|
|
|
|
usage: $SCRNAME [OPTIONS]
|
|
|
|
|
|
|
|
Options:
|
|
|
|
-o, --output-dir DIR
|
|
|
|
-l, --live-image NAME
|
|
|
|
-d, --debug # optional
|
|
|
|
|
|
|
|
"
|
|
|
|
|
|
|
|
OPTS=$(getopt -a -n live-build -o l:,o:,d,h \
|
|
|
|
-l live-image:,output-dir:,debug,help -- "$@")
|
|
|
|
|
|
|
|
function usage() {
|
|
|
|
echo "$__usage"
|
|
|
|
}
|
|
|
|
|
|
|
|
eval set -- "$OPTS"
|
|
|
|
while :; do
|
|
|
|
case "$1" in
|
|
|
|
-l | --live-image) LIVE="$2" ; shift 2 ;;
|
|
|
|
-o | --output-dir) OUTPUTDIR="$2" ; shift 2 ;;
|
|
|
|
-d | --debug) DEBUG="--debug" ; shift ;;
|
|
|
|
-h | --help) usage ;;
|
|
|
|
--) shift ; break ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$LIVE" ] || [ -z "$OUTPUTDIR" ]; then
|
|
|
|
echo "Options are not set properly."
|
|
|
|
usage
|
|
|
|
exit 12
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -e "/sys/fs/selinux/enforce" ]; then
|
|
|
|
enforce_check="$(cat /sys/fs/selinux/enforce)"
|
|
|
|
if [ "$enforce_check" -eq "1" ]; then
|
|
|
|
echo "Running with selinux enforcing is not recommended."
|
|
|
|
exit 22
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2024-04-02 02:23:11 +00:00
|
|
|
if [ ! -x "/usr/bin/kiwi-ng" ] || [ ! -x "$HOME/.local/bin/kiwi-ng" ]; then
|
2024-04-01 07:39:37 +00:00
|
|
|
echo "kiwi-ng not found. kiwi packages are likely not installed on this system."
|
|
|
|
exit 32
|
|
|
|
fi
|
|
|
|
|
|
|
|
function main() {
|
|
|
|
/bin/rm config.xml
|
|
|
|
if [ ! -f "configs/rocky-live-${LIVE,,}.xml" ]; then
|
|
|
|
echo "${LIVE} was not found. Is it supported?"
|
|
|
|
exit 42
|
|
|
|
fi
|
|
|
|
ln -s "configs/rocky-live-${LIVE,,}.xml" config.xml
|
|
|
|
kiwi-ng "$DEBUG" --type="iso" --profile="$LIVE-Live" --color-output system build --description="$SCRDIR" --target-dir "$OUTPUTDIR"
|
|
|
|
}
|
|
|
|
|
|
|
|
main
|