File: remaster-compose

package info (click to toggle)
remaster-iso 0.9.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 132 kB
  • sloc: sh: 376; makefile: 2
file content (105 lines) | stat: -rwxr-xr-x 3,366 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash

#set -x

## remaster-compose
## Copyright (C) 2019-2025 Richard Nelson <unixabg@gmail.com>
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.
############################
# Dependencies
############################
if [[ $EUID -ne 0 ]]; then
	echo "This script must be run as root"
	exit 1
fi

if [ ! -e /usr/lib/ISOLINUX/isohdpfx.bin ]; then
	echo "No /usr/lib/ISOLINUX/isohdpfx.bin file found!"
	echo "Exiting ..."
	echo "On Debian based systems, isolinux can be installed with:"
	echo "  apt install isolinux"
	exit 1
fi

if [ ! -e /usr/bin/xorriso ]; then
	echo "No /usr/bin/xorriso file found!"
	echo "Exiting ..."
	echo "On Debian based systems, xorriso can be installed with:"
	echo "  apt install xorriso"
	exit 1
fi

# Source in config
echo "Loading remaster-iso.conf ..."
if [ -f remaster-iso.conf ]; then
	echo "Found ./remaster-iso.conf"
	echo "Sourcing in ./remaster-iso.conf"
	. remaster-iso.conf
elif [ -f /usr/share/remaster-iso/remaster-iso.conf ]; then
	echo "Found /usr/share/remaster-iso/remaster-iso.conf"
	echo "Sourcing in /usr/share/remaster-iso/remaster-iso.conf"
	. /usr/share/remaster-iso/remaster-iso.conf
else
	echo "No remaster-iso.conf file found!"
	echo "Exiting ..."
	exit 1
fi

############################
# Main Code
############################
echo "Conf says remaster-iso version is ${_VER}"

# Set some values for remaster
while [ -n "$1" ]; do # while loop starts
	case "$1" in
	-itn | --iso-target-name)
		shift
		echo "I: --iso-target-name option was passed of $1"
		_ISOTargetName=$1
		;;
	-itt | --iso-target-title)
		shift
		echo "I: --iso-target-title was passed of $1"
		_ISOTargetTitle=$1
		;;
	--usage)
		echo
		echo "################## remaster-compose parameters ##################"
		echo "-itt || --iso-target-title      - set the target iso title"
		echo "-itn || --iso-target-name       - set the target iso name "
		echo "--usage                         - print this information  "
		echo
		exit 0
		;;
	*)
		echo "E: Unrecognized option of $1 !!Stopping here!!"
		exit 1
		;;
	esac
	shift
done

# Sanity check for work area
if [ -d "${_ISOExtractPath}" ]; then
	_BUILDDATE=$(date +%Y%m%d%H%M)
	echo "I: Attempting to compose the ISO: ${_BUILDDATE}-${_ISOTargetName} ..."
	echo "I: change directory to target live folder"
	cd "${_ISOExtractPath}"
	echo "I: creating a MD5SUMS file of iso contents"
	find -type f -print0 | xargs -0 md5sum | grep -v isolinux/boot.cat | tee MD5SUMS
	xorriso -as mkisofs -r -D -V "${_ISOTargetTitle} ${_VER}" -cache-inodes -J -l -iso-level 3 -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -c isolinux/boot.cat -b isolinux/isolinux.bin  -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat  -o "${_BASEDIR}/${_BUILDDATE}-${_ISOTargetName}.iso" .
	echo "I: ... ${_BUILDDATE}-${_ISOTargetName} ISO composition attempt is now complete."
	echo "I: Creating a MD5SUM of the completed iso file ..."
	md5sum "${_BASEDIR}/${_BUILDDATE}-${_ISOTargetName}.iso" > "${_BASEDIR}/${_BUILDDATE}-${_ISOTargetName}.iso.md5sum"
	echo "I: ... iso MD5SUM completed."
	exit 0
else
	echo "E: No iso-extract folder of ${_ISOExtractPath} !"
	echo "Exiting ..."
	exit 1
fi