void-bash-installer/run_in_chroot.sh

44 lines
970 B
Bash
Raw Normal View History

2021-03-11 14:04:04 +01:00
#!/bin/bash
dir="/tmp/installer"
wrksrc="${dir}"/tmp
functions="${dir}/functions"
modules="${dir}/modules"
config_mods="${modules}/config"
install_mods="${modules}/install"
chroot_mods="${modules}/chroot"
vars="${wrksrc}/vars"
declare -A cfg=()
declare -A users=()
#set -x
source "${functions}"/functions
2021-03-16 20:17:51 +01:00
for i in $(find "${vars}" -type f); do
source "${i}"
done
2021-03-16 22:38:22 +01:00
2021-03-17 00:06:12 +01:00
input=( "${@}" )
2021-03-16 23:58:43 +01:00
max="${#input[@]}"
2021-03-17 00:03:12 +01:00
echo 0 "${input[0]}"
echo 1 "${input[1]}"
echo 2 "${input[2]}"
2021-03-17 00:10:21 +01:00
for i in $(seq 0 "${max}"); do
if [[ "${i}" == "0" ]]; then
2021-03-16 23:58:43 +01:00
echo diskp "${input[$i]}"
cfg+=( [diskpw]="${input[$i]}" )
2021-03-16 22:46:00 +01:00
else
2021-03-16 23:58:43 +01:00
echo user "${input[$i]}"
2021-03-16 23:13:10 +01:00
users+=( [pw$i]="${input[$i]}" )
2021-03-16 22:46:00 +01:00
fi
2021-03-16 22:38:22 +01:00
done
2021-03-16 20:17:51 +01:00
export run="install"
for i in $(find "${modules}" -mindepth 1 -maxdepth 1 -type d | sort -n ); do
test -f "${i}"/install && source "${i}"/install
done
2021-03-11 14:04:04 +01:00
export run="post"
for i in $(find "${modules}" -mindepth 1 -maxdepth 1 -type d | sort -n); do
test -f "${i}"/post && source "${i}"/post
2021-03-16 20:17:51 +01:00
done