void-bash-installer/main.sh

51 lines
1.2 KiB
Bash
Raw Normal View History

2021-03-11 14:04:04 +01:00
#!/bin/bash
dir="$(pwd)"
wrksrc="${dir}/tmp"
2021-05-09 21:30:52 +02:00
step="${dir}/step"
2021-03-11 14:04:04 +01:00
functions="${dir}/functions"
vars="${wrksrc}/vars"
dest="${wrksrc}/dest"
2021-04-15 10:52:35 +02:00
files="${dir}/files"
2021-03-11 14:04:04 +01:00
rm -rf "${vars}"
mkdir -p "${wrksrc}" "${vars}" "${dest}"
declare -A cfg=()
declare -A users=()
#set -x
2021-04-07 17:58:11 +02:00
remote="https://alpha.de.repo.voidlinux.org/current"
#remote="https://void.cijber.net/current/"
2021-03-11 14:04:04 +01:00
source "${functions}"/functions
2021-04-15 11:07:48 +02:00
source "${dir}"/config
2021-05-09 19:10:37 +02:00
if mountpoint -q "${dest}"; then
umounter "${dest}"
fi
2021-03-17 00:28:27 +01:00
2021-03-17 00:28:02 +01:00
export run="config"
2021-05-09 21:52:18 +02:00
for i in $(find "${step}1" -mindepth 1 -maxdepth 1 -type f | sort -n ); do
2021-05-09 20:58:18 +02:00
test -f "${i}" && source "${i}"
2021-03-11 14:04:04 +01:00
done
2021-03-17 00:28:02 +01:00
export run="postconfig"
2021-05-09 21:52:18 +02:00
for i in $(find "${step}2" -mindepth 1 -maxdepth 1 -type f | sort -n ); do
2021-05-09 20:58:18 +02:00
test -f "${i}" && source "${i}"
2021-03-11 14:04:04 +01:00
done
2021-03-16 20:33:02 +01:00
mkdir -p "${dest}"/tmp/installer/tmp "${dest}"/etc
cp -rf /etc/resolv.conf "${dest}"/etc
2021-03-11 14:04:04 +01:00
cp -rf "${vars}" "${dest}"/tmp/installer/tmp
2021-05-09 21:30:52 +02:00
cp -rf "${step}3" "${dest}"/tmp/installer
cp -rf "${step}4" "${dest}"/tmp/installer
2021-04-15 10:43:20 +02:00
cp -rf "${files}" "${dest}"/tmp/installer
2021-03-11 14:04:04 +01:00
cp -rf "${functions}" "${dest}"/tmp/installer
cp -rf ./run_in_chroot.sh "${dest}"/tmp/installer
2021-03-16 22:38:22 +01:00
for i in $(seq 1 "${users[amount]}"); do
2021-03-16 23:09:35 +01:00
pw+=( "${users[pw$i]}" )
2021-03-16 22:38:22 +01:00
done
2021-03-17 00:10:21 +01:00
chroot "${dest}" "/tmp/installer/run_in_chroot.sh" "${cfg[diskpw]}" "${pw[@]}"
2021-03-11 14:04:04 +01:00
2021-03-16 22:53:09 +01:00
umounter "${dest}"