This repository has been archived by the owner on Dec 11, 2023. It is now read-only.
forked from grml/grml-live
-
Notifications
You must be signed in to change notification settings - Fork 0
/
auto-build.sh
executable file
·35 lines (29 loc) · 1.59 KB
/
auto-build.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
#!/bin/bash
set -e
# Check if this script is running as root
if [ "$EUID" -ne 0 ]; then printf "Please run as root\n" & exit 1; fi
## Variables
ISO_DATE_LONG="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
ISO_DATE="$(date -u +"%Y-%m-%d")"
INPUT="$(pwd)" # Set grml-live input directory
OUTPUT="$(pwd)/build/" # Set grml-live working directory
LIVE_CONF=${INPUT}/etc/grml/grml-live.conf # Set grml-live config file.
export INPUT OUTPUT LIVE_CONF # Export variables to be usable by grml-live
# export variable to env file
printf "ISO_DATE_LONG=${ISO_DATE_LONG}\nISO_DATE=${ISO_DATE}\nOUTPUT=${OUTPUT}" >> .env
## Dependencies
GRML_CONTROL_FILE=${INPUT}/debian/control # Set control file for solving dependencies
# Install dependencies
apt-get update && apt-get install -y debian-archive-keyring $(sed -n '/Package: grml-live/,/^$/{/^$/d; p}' "${GRML_CONTROL_FILE}" | awk '/Depends:/{flag=1; next}/misc:Depends/{flag=0;exit} flag' | sed -e 's/\s(.*)//g' -e 's/,//g')
## Prepare build
## Fast mode
if [[ $@ == *--fast* ]]; then
# Modify compression algorithm to use lz4 for faster build
sed -i -e 's/\-comp\ xz/\-comp\ lz4/' -e 's/\-Xdict\-size\ 1M\ //' ./grml-live.conf
GRML_ARGS="$(echo "${@/\-\-fast/}")"; fi # Remove from passed arguments
## Build
# Run grml-live
"${INPUT}/grml-live" -C ./grml-live.conf -d "${ISO_DATE_LONG}" -F -i grml64.iso ${GRML_UPDATE} -v "${ISO_DATE}" ${GRML_ARGS}
## Post build
mv "${OUTPUT}/grml_isos/grml64.iso" "${OUTPUT}/grml_isos/grml64-full-bullseye-${ISO_DATE}.iso"
sha256sum "${OUTPUT}/grml_isos/grml64-full-bullseye-${ISO_DATE}.iso" > "${OUTPUT}/grml_isos/grml64-full-bullseye-${ISO_DATE}.iso.sha256"