-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathuck-remaster-pack-iso
executable file
·110 lines (90 loc) · 3.65 KB
/
uck-remaster-pack-iso
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
106
107
108
109
110
#!/bin/bash
###################################################################################
# UCK - Ubuntu Customization Kit #
# Copyright (C) 2006-2010 UCK Team #
# #
# UCK is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# UCK is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with UCK. If not, see <http://www.gnu.org/licenses/>. #
###################################################################################
#############################
# general purpose functions #
#############################
function usage()
{
echo "Usage: $0 [iso-file-name.iso] [remaster-dir] [-h|--hybrid] [-g|--generate-md5] [-a|--arch=x86,x86_64,ia64,ppc] [-d|--description=CD_description]"
}
function failure()
{
echo "$@"
exit 1
}
#########################
# input parameter check #
#########################
ARCH="x86"
GENERATE_MD5_FOR_NEW_ISO=0
HYBRID=0
DESCRIPTION="Remastered Ubuntu LiveCD"
INPUT_PARAMS=`getopt -o d:hga: -l description:,generate-md5,arch: -n "$0" -- "$@"`
if [ $? != 0 ] ; then
exit 1
fi
eval set -- "$INPUT_PARAMS"
while :; do
case "$1" in
-h|--hybrid) shift;HYBRID=1;;
-g|--generate-md5) shift;GENERATE_MD5_FOR_NEW_ISO=1;;
-a|--arch) shift; ARCH=$1; shift;;
-d|--description) shift; DESCRIPTION="$1"; shift;;
--) shift; break;;
esac
done
NEW_ISO_FILE_NAME=$1
if [ -z "$NEW_ISO_FILE_NAME" ]; then
NEW_ISO_FILE_NAME="livecd.iso"
fi
NEW_ISO_DIR_NAME=`dirname "$NEW_ISO_FILE_NAME"`
NEW_ISO_FILE_NAME=`basename "$NEW_ISO_FILE_NAME"`
REMASTER_HOME=$2
if [ -z "$2" ]; then
REMASTER_HOME=~/tmp
fi
if [ "$ARCH" != "x86" ] && [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "ia64" ] && [ "$ARCH" != "ppc" ]; then
failure "Chosen architecture is not valid (x86, x86_64, ia64, ppc)"
fi
########
# main #
########
. libraries/remaster-live-cd.sh 2>/dev/null || . /usr/lib/uck/remaster-live-cd.sh 2>/dev/null || failure "libraries not found"
NEW_FILES_DIR="$REMASTER_HOME/remaster-new-files"
INITRD_REMASTER_DIR="$REMASTER_HOME/remaster-initrd"
ISO_REMASTER_DIR="$REMASTER_HOME/remaster-iso"
REMASTER_DIR="$REMASTER_HOME/remaster-root"
CUSTOMIZE_DIR="$REMASTER_HOME/customization-scripts"
if [ ! -e "$ISO_REMASTER_DIR" ]; then
failure "ISO remastering directory $ISO_REMASTER_DIR does not exists"
fi
prepare_new_files_directories ||
failure "Cannot create directory for new files"
pack_iso "$ARCH" "$DESCRIPTION" ||
failure "Cannot pack ISO"
if [ $GENERATE_MD5_FOR_NEW_ISO = 1 ]; then
generate_md5_for_new_iso ||
failure "Cannot generate md5sum for new ISO"
fi
if [ "$NEW_ISO_DIR_NAME" != "." ]
then
mv "$NEW_FILES_DIR/$NEW_ISO_FILE_NAME" "$NEW_ISO_DIR_NAME/$NEW_ISO_FILE_NAME" ||
failure "Cannot move $NEW_ISO_FILE_NAME to $NEW_ISO_DIR_NAME"
fi
exit 0