diff --git a/install.sh b/install.sh index ebd7569..6e2adc5 100755 --- a/install.sh +++ b/install.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash -i # CONSTANTS @@ -39,6 +39,7 @@ function install_miaou_proxmox { fi 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`' + true } function compute_cpu_cores { @@ -65,10 +66,20 @@ function choose_default { PS3="Choose default storage number: " echo "TYPE=ZFSPOOL STORAGE LIST:" echo "--------------------------" - storage_disk="${storages[0]}" - select storage_disk in "${storages[@]}"; do - [[ -n $storage_disk ]] && break - done + + + echo "$-" + if [[ ! "$-" =~ i ]]; then + echo non interactive + # non-interactive, default to first item + storage_disk="${storages[0]}" + else + echo interactive + # interactive, ask for default + select storage_disk in "${storages[@]}"; do + [[ -n $storage_disk ]] && break + done + fi cat > $CONFIG_FILE <