source: /cluster/svnroot/bccd-ng/branches/skylar/bccd-3.3.4/bin/regen_iso @ 6133

Last change on this file since 6133 was 6133, checked in by skylar, 18 months ago

style re #1015

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1#!/usr/bin/env bash
2
3# $Id: regen_iso 6133 2019-06-05 21:55:09Z skylar $
4
5# Script that will take in an already-unpacked ISO image, and an already unpacked squashfs
6# Will re-generate the squash, place it in the ISO image directory, then re-generate the ISO
7
8set -eo pipefail
9
10function usage() {
11    echo "$(basename "$0") -i <unpacked-iso-dir> -s <unpacked-squash-dir> -o <output-iso> [ -n <iso-name> ]" >&2
12}
13
14while getopts ":i:s:o:n:" opt; do
15        case ${opt} in
16        i )
17            ISO_DIR="${OPTARG}"
18            ;;
19        s )
20            SQUASH_DIR="${OPTARG}"
21            ;;
22        o )
23            OUT_ISO="${OPTARG}"
24            ;;
25        n )
26            ISO_NAME="${OPTARG}"
27            ;;
28        \? )
29            usage
30            exit 1
31    esac
32done
33
34if [[ -z ${ISO_DIR} || -z ${SQUASH_DIR} || -z ${OUT_ISO} ]]; then
35    echo "Supply all arguments" >&2
36    usage
37    exit 1
38fi
39
40LIVE_ISO_DIR="${ISO_DIR}/live"
41SQUASH_OUT="${LIVE_ISO_DIR}/filesystem.squashfs"
42
43if [[ ! -d "${ISO_DIR}" || ! -d "${LIVE_ISO_DIR}" ]]; then
44    echo "${ISO_DIR} must be a directory containing a live directory" >&2
45    exit 2
46fi
47
48if [[ ! -d "${SQUASH_DIR}" ]]; then
49    echo "${SQUASH_DIR} does not exist" >&2
50    exit 2
51fi
52
53if [[ -f "${SQUASH_OUT}" ]]; then
54    sudo rm -f "${LIVE_ISO_DIR}"/filesystem.squashfs
55fi
56
57sudo nice mksquashfs "${SQUASH_DIR}" "${SQUASH_OUT}"
58
59genisoimage -pad -l -r -J -v -V "${ISO_NAME}" -no-emul-boot -boot-load-size 4 -boot-info-table \
60    -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -hide-rr-moved \
61    -o "${OUT_ISO}" \
62    "${ISO_DIR}"
Note: See TracBrowser for help on using the repository browser.