feat(iso): Allow supplementary password/settings file (#9)
This commit is contained in:
29
setup.sh
29
setup.sh
@@ -256,8 +256,14 @@ function no_zpool_exists () {
|
||||
}
|
||||
|
||||
function set_zpool_password () {
|
||||
local zpool_password
|
||||
if [[ "${ARCHZBM_ZPOOL_PASSWORD}" ]]; then
|
||||
zpool_password="${ARCHZBM_ZPOOL_PASSWORD}"
|
||||
else
|
||||
zpool_password='password'
|
||||
fi
|
||||
# May or may not have a newline at the end, ZFS doesn't care
|
||||
printf -- '%s' 'password' > '/etc/zfs/'"${zpool_name}"'.key'
|
||||
printf -- '%s' "${zpool_password}" > '/etc/zfs/'"${zpool_name}"'.key'
|
||||
chmod '000' '/etc/zfs/'"${zpool_name}"'.key'
|
||||
}
|
||||
|
||||
@@ -319,6 +325,18 @@ function export_pool () {
|
||||
zpool export "${zpool_name}"
|
||||
}
|
||||
|
||||
function load_settings_file () {
|
||||
local working_dir settings_file settings_abs
|
||||
working_dir="$(pwd)"
|
||||
settings_file='archzbm_settings.env'
|
||||
settings_abs="${working_dir}"'/'"${settings_file}"
|
||||
if [[ -r "${settings_abs}" ]]; then
|
||||
set -a
|
||||
source "${settings_abs}"
|
||||
set +a
|
||||
fi
|
||||
}
|
||||
|
||||
function setup_zpool () {
|
||||
#1.8
|
||||
local drive_by_id
|
||||
@@ -764,7 +782,13 @@ function install_os_in_chroot () {
|
||||
|
||||
function set_root_pw () {
|
||||
#3.2
|
||||
printf -- '%s\n' 'root:password' | chpasswd --crypt-method 'SHA512' --root '/mnt'
|
||||
local root_password
|
||||
if [[ "${ARCHZBM_ROOT_PASSWORD}" ]]; then
|
||||
root_password="${ARCHZBM_ROOT_PASSWORD}"
|
||||
else
|
||||
root_password='password'
|
||||
fi
|
||||
printf -- '%s\n' 'root:'"${root_password}" | chpasswd --crypt-method 'SHA512' --root '/mnt'
|
||||
}
|
||||
|
||||
function configure_networking () {
|
||||
@@ -893,6 +917,7 @@ function main () {
|
||||
install_pkgs 'jq' #1.5
|
||||
install_zfs #1.6
|
||||
uefi_or_bios #1.7
|
||||
load_settings_file
|
||||
setup_zpool #1.8
|
||||
mount_system #1.9
|
||||
copy_zpool_cache #1.10
|
||||
|
Reference in New Issue
Block a user