-
Notifications
You must be signed in to change notification settings - Fork 6
/
cld.sh
executable file
·46 lines (38 loc) · 1.38 KB
/
cld.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
#!/bin/bash
set -e
# Description: Main script to create Cust-Live-Deb system.
SYSTEM=$(echo $1 | tr '[:upper:]' '[:lower:]')
DEB_REPO_URL=$2
# Error handling
ARGS_REQUIRED=2
CMD_EXAMPLES=$(printf " %s\n %s\n %s\n" \
" e.g. $0 <SYSTEM> <DEB_REPO_URL>"\
" e.g. $0 std http://ftp.debian.org/debian"\
" e.g. $0 min http://localhost/aptly-repo/master_jessie-main"\
)
if [ "$#" -ne "${ARGS_REQUIRED}" ]; then
echo "Error: ${ARGS_REQUIRED} arguments are required. Aborted!"
echo "${CMD_EXAMPLES}"
exit 1;
fi
# Update manuals.
./cld-manuals-create.sh
# Update cld-tools scripts on the host. Ensure the latest scripts and versions.
./cld-tools-deploy.sh
# Build ISO
CHROOT_DIR=/media/cld-img/chroot/
mkdir -p "${CHROOT_DIR}"
CHROOT_DIR=$(readlink -ev "${CHROOT_DIR}")
iso_output_dir=$(readlink -ev "/media/sql")
./cld-umount.sh "${CHROOT_DIR}" || true
./cld-debootstrap.sh "${CHROOT_DIR}" "${DEB_REPO_URL}"
./cld-mount.sh "${CHROOT_DIR}"
./cld-chroot.sh "${SYSTEM}" "${CHROOT_DIR}"
./cld-umount.sh "${CHROOT_DIR}" || true
./cld-chroot-log-backup.sh "${CHROOT_DIR}/root/scripts/logs" "${PWD}"
./cld-mkiso.sh "${SYSTEM}" "${CHROOT_DIR}" "${iso_output_dir}" ignore
# Logs.
LOG_DIR=./logs/
./cld-shlog.sh "${LOG_DIR}"
./cld-logs-extract-package-sizes.sh "${LOG_DIR}"
./cld-logs-backup.sh "${LOG_DIR}"