Browse Source

fix install.sh no configuration file

main
pvincent 1 week ago
parent
commit
612942e551
  1. 25
      install.sh

25
install.sh

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/bash -i
# CONSTANTS # CONSTANTS
@ -39,6 +39,7 @@ function install_miaou_proxmox {
fi fi
status=$(/opt/miaou-bash/tools/append_or_replace '^PATH=\$PATH:/opt/miaou-proxmox/bin' 'PATH=$PATH:/opt/miaou-proxmox/bin' $HOME/.bashrc) status=$(/opt/miaou-bash/tools/append_or_replace '^PATH=\$PATH:/opt/miaou-proxmox/bin' 'PATH=$PATH:/opt/miaou-proxmox/bin' $HOME/.bashrc)
[[ $status == 'appended' ]] && echo 'successfully installed! please run `source $HOME/.bashrc`' [[ $status == 'appended' ]] && echo 'successfully installed! please run `source $HOME/.bashrc`'
true
} }
function compute_cpu_cores { function compute_cpu_cores {
@ -65,10 +66,20 @@ function choose_default {
PS3="Choose default storage number: " PS3="Choose default storage number: "
echo "TYPE=ZFSPOOL STORAGE LIST:" echo "TYPE=ZFSPOOL STORAGE LIST:"
echo "--------------------------" echo "--------------------------"
echo "$-"
if [[ ! "$-" =~ i ]]; then
echo non interactive
# non-interactive, default to first item
storage_disk="${storages[0]}" storage_disk="${storages[0]}"
else
echo interactive
# interactive, ask for default
select storage_disk in "${storages[@]}"; do select storage_disk in "${storages[@]}"; do
[[ -n $storage_disk ]] && break [[ -n $storage_disk ]] && break
done done
fi
cat > $CONFIG_FILE <<EOF cat > $CONFIG_FILE <<EOF
STORAGE_DISK=\${STORAGE_DISK:-$storage_disk} STORAGE_DISK=\${STORAGE_DISK:-$storage_disk}
@ -102,8 +113,10 @@ function initialize {
# MAIN # MAIN
set Eue set Eue
assert_root
assert_proxmox
install_miaou_bash
install_miaou_proxmox
initialize
# assert_root
# assert_proxmox
# install_miaou_bash
# install_miaou_proxmox
choose_default
#initialize
Loading…
Cancel
Save