Files
lnx-arch/scripts/archinstall_config_download.sh
2024-11-10 19:22:42 -05:00

45 lines
1006 B
Bash
Executable File

#!/usr/bin/env bash
# klevstul
echo "<< archinstall_config_download.sh >>"
src_file_conf=user_configuration.json
src_file_cred=user_credentials.json
src_base_url=https://gt.op.fo/fro/lnx-arch/raw/branch/master/dots/archinstall/
trg_dir=/tmp
if [ "$EUID" -ne 0 ]
then echo "error: run as 'root'"
exit
fi
# ---------------------------------
# download user_configuration.json
# ---------------------------------
echo "enter host name:"
read user_input
host_name=${user_input}
src_url=${src_base_url}/${host_name}/${src_file_conf}
curl -o ${trg_dir}/${src_file_conf} ${src_url}
# ---------------------------------
# download user_credentials.json
# ---------------------------------
src_url=${src_base_url}/common/${src_file_cred}
curl -o ${trg_dir}/${src_file_cred} ${src_url}
echo "enter password for user:"
read -s user_input # -s for silent mode (do not display input in cli)
password=${user_input}
sed -i -e "s/<PASSWORD>/${password}/g" ${trg_dir}/${src_file_cred}
ls -al user_c*
date