backup push
This commit is contained in:
parent
3a30bcbe62
commit
5ac473606e
2 changed files with 12 additions and 29 deletions
|
@ -80,14 +80,10 @@ done
|
||||||
if [[ $type == 'archlinux' ]]; then
|
if [[ $type == 'archlinux' ]]; then
|
||||||
|
|
||||||
# Ensure base.list exists, if not error and quit
|
# Ensure base.list exists, if not error and quit
|
||||||
[[ ! -e arkanium-build.d/$variant/base.list ]] &&
|
if [[ ! -e arkanium-build.d/$variant/base.list ]]; then
|
||||||
printf "\e[1;31m<#>\e[0m\e[1m The required file 'base.list' is not preset in arkanium-build.d/$(readlink -m $variant)\e[0m\n" &&
|
printf "\e[1;31m<#>\e[0m\e[1m The required file 'base.list' is not preset in $(readlink -m $configs_dir/$variant)\e[0m\n" &&
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
# Check if optional packages.list file exists, if not notify and continue
|
|
||||||
[[ ! -e arkanium-build.d/$variant/packages.list ]] &&
|
|
||||||
printf "\e[1;34m-->\e[0m\e[1m The optional file 'packages.list' is not preset in arkanium-build.d/$(readlink -m $variant), running without it\e[0m\n" &&
|
|
||||||
skip_secondary_package_installation=1
|
|
||||||
|
|
||||||
printf '\e[1;34m-->\e[0m\e[1m Started Arch linux image build\e[0m\n'
|
printf '\e[1;34m-->\e[0m\e[1m Started Arch linux image build\e[0m\n'
|
||||||
|
|
||||||
|
@ -103,6 +99,7 @@ if [[ $type == 'archlinux' ]]; then
|
||||||
pacstrap $workdir ${base_packages[*]} || cleanup_and_quit 'Failed to install secondary package list'
|
pacstrap $workdir ${base_packages[*]} || cleanup_and_quit 'Failed to install secondary package list'
|
||||||
|
|
||||||
# Read package list and install secondary system components, skip if not used
|
# Read package list and install secondary system components, skip if not used
|
||||||
|
|
||||||
if [[ ! -n skip_secondary_package_installation ]]; then
|
if [[ ! -n skip_secondary_package_installation ]]; then
|
||||||
printf '\e[1;34m-->\e[0m\e[1m Installing secondary packages...\e[0m\n'
|
printf '\e[1;34m-->\e[0m\e[1m Installing secondary packages...\e[0m\n'
|
||||||
readarray packages < arkanium-build.d/$variant/packages.list
|
readarray packages < arkanium-build.d/$variant/packages.list
|
||||||
|
|
|
@ -83,16 +83,16 @@ init () {
|
||||||
# Create directory structure
|
# Create directory structure
|
||||||
printf "\e[1;34m-->\e[0m\e[1m Creating directory structure\e[0m\n"
|
printf "\e[1;34m-->\e[0m\e[1m Creating directory structure\e[0m\n"
|
||||||
mkdir -pv $(readlink -m $arkanium_dir/deployments) \
|
mkdir -pv $(readlink -m $arkanium_dir/deployments) \
|
||||||
$(readlink -m $arkanium_dir/deployments/primary_a) \
|
$(readlink -m $arkanium_dir/deployments) \
|
||||||
$(readlink -m $arkanium_dir/deployments/primary_b) \
|
|
||||||
$(readlink -m $arkanium_dir/data) \
|
|
||||||
$(readlink -m $arkanium_dir/cache) \
|
$(readlink -m $arkanium_dir/cache) \
|
||||||
|
$(readlink -m $arkanium_dir/templates) \
|
||||||
|
$(readlink -m $arkanium_dir/overlay) \
|
||||||
$(readlink -m $arkanium_dir/shared) ||
|
$(readlink -m $arkanium_dir/shared) ||
|
||||||
cleanup_and_quit "Failed to create /arkanium and related directories"
|
cleanup_and_quit "Failed to create /arkanium and related directories"
|
||||||
|
|
||||||
# Add home shared subvolume and make writable
|
# Add home shared subvolume and make writable
|
||||||
btrfs subvolume create $(readlink -m ${arkanium_dir}/shared/home) || cleanup_and_quit "Failed to create home subvolume"
|
btrfs subvolume create $(readlink -m ${arkanium_dir}/shared/home) || cleanup_and_quit "Failed to create home subvolume"
|
||||||
btrfs property set -f -ts $(readlink -m ${arkanium_dir}/shared/home)
|
btrfs property set -f -ts $(readlink -m ${arkanium_dir}/shared/home) ro false
|
||||||
|
|
||||||
# Write default config file
|
# Write default config file
|
||||||
printf "\e[1;34m-->\e[0m\e[1m Adding default config file\e[0m\n"
|
printf "\e[1;34m-->\e[0m\e[1m Adding default config file\e[0m\n"
|
||||||
|
@ -107,25 +107,14 @@ init () {
|
||||||
custom_packages=0
|
custom_packages=0
|
||||||
END
|
END
|
||||||
|
|
||||||
# Write bootloader entries
|
# Add default bootloader config file
|
||||||
# TODO: Just loop this
|
cat <<- END > $arkanium_dir/templates/systemd-boot
|
||||||
printf "\e[1;34m-->\e[0m\e[1m Adding bootloader entries\e[0m\n"
|
|
||||||
cat <<- END > /boot/loader/entries/${os_name}-primary-a.conf
|
|
||||||
title Arkane GNU/Linux - Primary A
|
title Arkane GNU/Linux - Primary A
|
||||||
linux /vmlinuz-linux
|
linux /vmlinuz-linux
|
||||||
initrd /amd-ucode.img
|
initrd /amd-ucode.img
|
||||||
initrd /intel-ucode.img
|
initrd /intel-ucode.img
|
||||||
initrd /initramfs-linux.img
|
initrd /initramfs-linux.img
|
||||||
options root="LABEL=arkane_root" rootflags=subvol=arkanium/deployments/primary_a/rootfs rw
|
options root="LABEL=arkane_root" rootflags=subvol=${arkanium_dir}/${data} rw
|
||||||
END
|
|
||||||
|
|
||||||
cat <<- END > /boot/loader/entries/${os_name}-primary-b.conf
|
|
||||||
title Arkane GNU/Linux - Primary B
|
|
||||||
linux /vmlinuz-linux
|
|
||||||
initrd /amd-ucode.img
|
|
||||||
initrd /intel-ucode.img
|
|
||||||
initrd /initramfs-linux.img
|
|
||||||
options root="LABEL=arkane_root" rootflags=subvol=arkanium/deployments/primary_b/rootfs rw
|
|
||||||
END
|
END
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -167,9 +156,6 @@ teardown () {
|
||||||
btrfs property set -f -ts $(readlink -m $arkanium_dir) ro false
|
btrfs property set -f -ts $(readlink -m $arkanium_dir) ro false
|
||||||
btrfs subvolume delete $(readlink -m $arkanium_dir)
|
btrfs subvolume delete $(readlink -m $arkanium_dir)
|
||||||
|
|
||||||
# Remove bootloader files
|
|
||||||
rm -v /boot/loader/entries/${os_name}-*
|
|
||||||
|
|
||||||
else
|
else
|
||||||
printf '\e[1;34m-->\e[0m\e[1m Teardown canceled, no changes made to system\e[0m\n'
|
printf '\e[1;34m-->\e[0m\e[1m Teardown canceled, no changes made to system\e[0m\n'
|
||||||
fi
|
fi
|
||||||
|
@ -201,7 +187,7 @@ deploy () {
|
||||||
# If latest is requested grab latest file
|
# If latest is requested grab latest file
|
||||||
[[ $deploy_version == 'latest' ]] &&
|
[[ $deploy_version == 'latest' ]] &&
|
||||||
declare latest_data=$(curl -sf "${repo_url}/${deploy_target}/${deploy_version}") &&
|
declare latest_data=$(curl -sf "${repo_url}/${deploy_target}/${deploy_version}") &&
|
||||||
# Split latest_version at the delimiter, creating an array with data.1=package ver, data.2=compression method
|
# Split latest_version at the delimiter, creating an array with data.1=package ver, data.2=compression method, data.3=sha1 hash
|
||||||
readarray -d : -t data <<< "$latest_data"
|
readarray -d : -t data <<< "$latest_data"
|
||||||
# A carriage feed is inserted for some reason, lets remove it
|
# A carriage feed is inserted for some reason, lets remove it
|
||||||
data[2]=${data[2]//[$'\t\r\n']}
|
data[2]=${data[2]//[$'\t\r\n']}
|
||||||
|
|
Loading…
Add table
Reference in a new issue