-
Notifications
You must be signed in to change notification settings - Fork 1
/
create-bluecat.sh
executable file
·115 lines (105 loc) · 3.09 KB
/
create-bluecat.sh
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
111
112
113
114
115
#!/bin/bash
# Title :create-bluecat.sh
# Description :This script will create BlueCat.
# Author :Luis Sequeira
# Date :11/05/2020
# Version :2.4
# Usage :./create-bluecat.sh --games --clean
#==============================================================================
start_time=`date +%s`
echo ""
echo "Starting at ${start_time}"
export BLUECAT_DIR=${PWD}
while [ -n "$1" ]; do
case "$1" in
--games)
echo ""
echo "==========================="
echo "BlueCat Games will be created"
echo "==========================="
GAMES=true
;;
--clean)
echo ""
echo "==========================="
echo "Old files, cahe and tmp will be clean"
echo "==========================="
CLEAN=true
;;
*)
echo ""
echo "==========================="
echo "Option $1 not recognized"
echo "==========================="
;;
esac
shift
done
if [ ! -z "$CLEAN" ]; then
echo "==========================="
echo "Cleaning old files, cahe and tmp"
echo "==========================="
if [ -f "${BLUECAT_DIR}/BlueCat.iso" ]; then
rm -f ${BLUECAT_DIR}/BlueCat.iso*
fi
if [ -f "${BLUECAT_DIR}/BlueCat-Games.iso" ]; then
rm -f ${BLUECAT_DIR}/BlueCat-Games.iso*
fi
if [ -f "${BLUECAT_DIR}/BlueCat.log" ]; then
rm -f ${BLUECAT_DIR}/BlueCat.log
fi
if [ -f "${BLUECAT_DIR}/BlueCat-Games.log" ]; then
rm -f ${BLUECAT_DIR}/BlueCat-Games.log
fi
rm -rf /var/cache/live/*
rm -rf /var/tmp/*
fi
echo "==========================="
echo "Creating iso"
echo "==========================="
setenforce 0
if [ ! -z "$GAMES" ]; then
livecd-creator --verbose \
--config=${BLUECAT_DIR}/bluecat-games.ks \
--fslabel=BlueCat-Games \
--cache=/var/cache/live \
--logfile=${BLUECAT_DIR}/BlueCat-Games.log
else
livecd-creator --verbose \
--config=${BLUECAT_DIR}/bluecat.ks \
--fslabel=BlueCat \
--cache=/var/cache/live \
--logfile=${BLUECAT_DIR}/BlueCat.log
fi
setenforce 1
echo "==========================="
echo "Livecd-creator has finished"
echo "==========================="
if [ ! -z "$GAMES" ]; then
if [ -f "${BLUECAT_DIR}/BlueCat-Games.iso" ]; then
echo "BlueCat Games has been created"
echo "Creating md5 file"
md5sum ${BLUECAT_DIR}/BlueCat-Games.iso > ${BLUECAT_DIR}/BlueCat-Games.iso.md5
echo "Checking md5 file"
md5sum -c ${BLUECAT_DIR}/BlueCat-Games.iso.md5
echo "Files created:"
ls -l ${BLUECAT_DIR}/BlueCat*
else
echo "There was a error and BlueCat.iso was not created"
fi
else
if [ -f "${BLUECAT_DIR}/BlueCat.iso" ]; then
echo "BlueCat has been created"
echo "Creating md5 file"
md5sum ${BLUECAT_DIR}/BlueCat.iso > ${BLUECAT_DIR}/BlueCat.iso.md5
echo "Checking md5 file"
md5sum -c ${BLUECAT_DIR}/BlueCat.iso.md5
echo "Files created:"
ls -l ${BLUECAT_DIR}/BlueCat*
else
echo "There was a error and BlueCat.iso was not created"
fi
fi
end_time=`date +%s`
runtime=$((end_time-start_time))
echo "Run time was ${runtime} seconds"