Added --build-all option
This commit is contained in:
parent
f395f7aec1
commit
ddbe3b0e71
1 changed files with 49 additions and 12 deletions
61
Build Linux
61
Build Linux
|
|
@ -40,7 +40,7 @@ function ask() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
for d in "$TEMP_DIR" "$LIVE_DIR"; do
|
for d in "$TEMP_DIR" "$LIVE_DIR"; do
|
||||||
if [[ -d "$d" ]]; then
|
if [[ -d "$d" ]]; then
|
||||||
|
|
@ -116,7 +116,7 @@ function copy_live_env() {
|
||||||
rmdir "$LIVE_DIR/airootfs/etc/udev" --ignore-fail-on-non-empty
|
rmdir "$LIVE_DIR/airootfs/etc/udev" --ignore-fail-on-non-empty
|
||||||
rm "$LIVE_DIR/isolinux"/*.cfg
|
rm "$LIVE_DIR/isolinux"/*.cfg
|
||||||
rm "$LIVE_DIR/syslinux"/*.cfg "$LIVE_DIR/syslinux"/*.png
|
rm "$LIVE_DIR/syslinux"/*.cfg "$LIVE_DIR/syslinux"/*.png
|
||||||
|
|
||||||
# Add items
|
# Add items
|
||||||
rsync -aI "$ROOT_DIR/.linux_items/include/" "$LIVE_DIR/"
|
rsync -aI "$ROOT_DIR/.linux_items/include/" "$LIVE_DIR/"
|
||||||
if [[ "${1:-}" != "--minimal" ]]; then
|
if [[ "${1:-}" != "--minimal" ]]; then
|
||||||
|
|
@ -195,7 +195,7 @@ function update_live_env() {
|
||||||
# Hostname
|
# Hostname
|
||||||
echo "$hostname" > "$LIVE_DIR/airootfs/etc/hostname"
|
echo "$hostname" > "$LIVE_DIR/airootfs/etc/hostname"
|
||||||
echo "127.0.1.1 $hostname.localdomain $hostname" >> "$LIVE_DIR/airootfs/etc/hosts"
|
echo "127.0.1.1 $hostname.localdomain $hostname" >> "$LIVE_DIR/airootfs/etc/hosts"
|
||||||
|
|
||||||
# Live packages
|
# Live packages
|
||||||
while read -r p; do
|
while read -r p; do
|
||||||
sed -i "/$p/d" "$LIVE_DIR/packages.x86_64"
|
sed -i "/$p/d" "$LIVE_DIR/packages.x86_64"
|
||||||
|
|
@ -215,7 +215,7 @@ function update_live_env() {
|
||||||
sed -i -r 's/^(.*mirrorlist.*)$/#NOPE#\1/' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
sed -i -r 's/^(.*mirrorlist.*)$/#NOPE#\1/' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
echo "curl -o '/etc/pacman.d/mirrorlist' '$MIRRORLIST_SOURCE'" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "curl -o '/etc/pacman.d/mirrorlist' '$MIRRORLIST_SOURCE'" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
echo "sed -i 's/#Server/Server/g' /etc/pacman.d/mirrorlist" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "sed -i 's/#Server/Server/g' /etc/pacman.d/mirrorlist" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
|
|
||||||
# MOTD
|
# MOTD
|
||||||
sed -i -r "s/_+/$KIT_NAME_FULL Linux Environment/" "$LIVE_DIR/airootfs/etc/motd"
|
sed -i -r "s/_+/$KIT_NAME_FULL Linux Environment/" "$LIVE_DIR/airootfs/etc/motd"
|
||||||
|
|
||||||
|
|
@ -223,7 +223,7 @@ function update_live_env() {
|
||||||
git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git "$SKEL_DIR/.oh-my-zsh"
|
git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git "$SKEL_DIR/.oh-my-zsh"
|
||||||
rm -Rf "$SKEL_DIR/.oh-my-zsh/.git"
|
rm -Rf "$SKEL_DIR/.oh-my-zsh/.git"
|
||||||
curl -o "$SKEL_DIR/.oh-my-zsh/themes/lean.zsh-theme" https://raw.githubusercontent.com/miekg/lean/master/prompt_lean_setup
|
curl -o "$SKEL_DIR/.oh-my-zsh/themes/lean.zsh-theme" https://raw.githubusercontent.com/miekg/lean/master/prompt_lean_setup
|
||||||
|
|
||||||
if [[ "${1:-}" != "--minimal" ]]; then
|
if [[ "${1:-}" != "--minimal" ]]; then
|
||||||
# Openbox theme
|
# Openbox theme
|
||||||
git clone --depth=1 https://github.com/addy-dclxvi/Openbox-Theme-Collections.git "$TEMP_DIR/ob-themes"
|
git clone --depth=1 https://github.com/addy-dclxvi/Openbox-Theme-Collections.git "$TEMP_DIR/ob-themes"
|
||||||
|
|
@ -238,7 +238,7 @@ function update_live_env() {
|
||||||
# Shutdown stall fix
|
# Shutdown stall fix
|
||||||
echo "sed -i -r 's/^.*(DefaultTimeoutStartSec)=.*$/\1=15s/' /etc/systemd/system.conf" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "sed -i -r 's/^.*(DefaultTimeoutStartSec)=.*$/\1=15s/' /etc/systemd/system.conf" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
echo "sed -i -r 's/^.*(DefaultTimeoutStopSec)=.*$/\1=15s/' /etc/systemd/system.conf" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "sed -i -r 's/^.*(DefaultTimeoutStopSec)=.*$/\1=15s/' /etc/systemd/system.conf" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
|
|
||||||
# SSH
|
# SSH
|
||||||
mkdir -p "$SKEL_DIR/.ssh"
|
mkdir -p "$SKEL_DIR/.ssh"
|
||||||
ssh-keygen -b 4096 -C "$username@$hostname" -N "" -f "$SKEL_DIR/.ssh/id_rsa"
|
ssh-keygen -b 4096 -C "$username@$hostname" -N "" -f "$SKEL_DIR/.ssh/id_rsa"
|
||||||
|
|
@ -247,7 +247,7 @@ function update_live_env() {
|
||||||
sed -i -r '/.*PermitRootLogin.*/d' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
sed -i -r '/.*PermitRootLogin.*/d' "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
echo "sed -i -r '/.*PermitRootLogin.*/d' /etc/ssh/sshd_config" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "sed -i -r '/.*PermitRootLogin.*/d' /etc/ssh/sshd_config" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
cp "$ROOT_DIR/.linux_items/authorized_keys" "$SKEL_DIR/.ssh/authorized_keys"
|
cp "$ROOT_DIR/.linux_items/authorized_keys" "$SKEL_DIR/.ssh/authorized_keys"
|
||||||
|
|
||||||
# Root user
|
# Root user
|
||||||
echo "echo 'root:$ROOT_PASSWORD' | chpasswd" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
echo "echo 'root:$ROOT_PASSWORD' | chpasswd" >> "$LIVE_DIR/airootfs/root/customize_airootfs.sh"
|
||||||
|
|
||||||
|
|
@ -339,7 +339,7 @@ function build_iso() {
|
||||||
echo "Aborted."
|
echo "Aborted."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set permissions
|
# Set permissions
|
||||||
echo "Setting permissions..."
|
echo "Setting permissions..."
|
||||||
chown root:root "$LIVE_DIR" -R
|
chown root:root "$LIVE_DIR" -R
|
||||||
|
|
@ -354,7 +354,7 @@ function build_iso() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
# Build ISO
|
# Build ISO
|
||||||
prefix="${KIT_NAME_SHORT}-Linux"
|
prefix="${KIT_NAME_SHORT}-Linux"
|
||||||
label="${KIT_NAME_SHORT}_LINUX"
|
label="${KIT_NAME_SHORT}_LINUX"
|
||||||
|
|
@ -369,13 +369,44 @@ function build_iso() {
|
||||||
chown $REAL_USER:$REAL_USER "$OUT_DIR" -R
|
chown $REAL_USER:$REAL_USER "$OUT_DIR" -R
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function build_all() {
|
||||||
|
if [[ "$EUID" -eq 0 ]]; then
|
||||||
|
echo "This section not meant to be run as root."
|
||||||
|
echo "Aborted."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prep for build (full)
|
||||||
|
cleanup
|
||||||
|
fix_kit_permissions
|
||||||
|
install_deps
|
||||||
|
load_settings --edit
|
||||||
|
update_repo
|
||||||
|
copy_live_env
|
||||||
|
update_live_env
|
||||||
|
# Rerun script as root to start Archiso build process
|
||||||
|
run_elevated "$(realpath "$0")" --build-iso
|
||||||
|
# Cleanup
|
||||||
|
mv -nv "$LIVE_DIR" "${LIVE_DIR}.full"
|
||||||
|
perl-rename -v "s/^(${KIT_NAME_FULL}-Linux)-(${DATE}.*)$/\1-Full-\2/" "$OUT_DIR"/*
|
||||||
|
|
||||||
|
# Prep for build (minimal)
|
||||||
|
copy_live_env --minimal
|
||||||
|
update_live_env --minimal
|
||||||
|
# Rerun script as root to start Archiso build process
|
||||||
|
run_elevated "$(realpath "$0")" --build-iso
|
||||||
|
# Cleanup
|
||||||
|
mv -nv "$LIVE_DIR" "${LIVE_DIR}.minimal"
|
||||||
|
perl-rename -v "s/^(${KIT_NAME_FULL}-Linux)-(${DATE}.*)$/\1-Minimal-\2/" "$OUT_DIR"/*
|
||||||
|
}
|
||||||
|
|
||||||
function build_full() {
|
function build_full() {
|
||||||
if [[ "$EUID" -eq 0 ]]; then
|
if [[ "$EUID" -eq 0 ]]; then
|
||||||
echo "This section not meant to be run as root."
|
echo "This section not meant to be run as root."
|
||||||
echo "Aborted."
|
echo "Aborted."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Prep for build
|
# Prep for build
|
||||||
cleanup
|
cleanup
|
||||||
fix_kit_permissions
|
fix_kit_permissions
|
||||||
|
|
@ -390,6 +421,11 @@ function build_full() {
|
||||||
|
|
||||||
# Check input
|
# Check input
|
||||||
case ${1:-} in
|
case ${1:-} in
|
||||||
|
-a|--build-all)
|
||||||
|
build_all
|
||||||
|
echo Done
|
||||||
|
;;
|
||||||
|
|
||||||
-b|--build-full)
|
-b|--build-full)
|
||||||
build_full
|
build_full
|
||||||
echo Done
|
echo Done
|
||||||
|
|
@ -417,7 +453,7 @@ case ${1:-} in
|
||||||
build_iso
|
build_iso
|
||||||
echo Done
|
echo Done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-p|--prep-live-env)
|
-p|--prep-live-env)
|
||||||
load_settings --edit
|
load_settings --edit
|
||||||
copy_live_env
|
copy_live_env
|
||||||
|
|
@ -434,7 +470,8 @@ case ${1:-} in
|
||||||
echo "Usage: $(basename "$0") [OPTIONS]"
|
echo "Usage: $(basename "$0") [OPTIONS]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -b --build-full Perform all tasks and build iso"
|
echo " -a --build-all Perform all tasks to build all isos"
|
||||||
|
echo " -b --build-full Perform all tasks to build the full iso"
|
||||||
echo " -h --help Show usage"
|
echo " -h --help Show usage"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Advanced options:"
|
echo "Advanced options:"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue