add idiot proof (not really) prompt
This commit is contained in:
parent
b7295a83ef
commit
055378b137
|
@ -21,7 +21,8 @@ Installation
|
||||||
|
|
||||||
wget https://raw.githubusercontent.com/gh2o/digitalocean-debian-to-arch/debian8/install.sh && bash install.sh
|
wget https://raw.githubusercontent.com/gh2o/digitalocean-debian-to-arch/debian8/install.sh && bash install.sh
|
||||||
|
|
||||||
3. Sit back and relax! The system will automatically reboot once complete,
|
3. Follow the instructions when prompted.
|
||||||
|
4. Sit back and relax! The system will automatically reboot once complete,
|
||||||
and you should have a fully updated Arch Linux system in within minutes.
|
and you should have a fully updated Arch Linux system in within minutes.
|
||||||
|
|
||||||
Advanced Configuration
|
Advanced Configuration
|
||||||
|
|
26
install.sh
26
install.sh
|
@ -46,6 +46,9 @@ target_disklabel="gpt"
|
||||||
# new filesystem type (ext4/btrfs)
|
# new filesystem type (ext4/btrfs)
|
||||||
target_filesystem="ext4"
|
target_filesystem="ext4"
|
||||||
|
|
||||||
|
# NOT EXPOSED NORMALLY: don't prompt
|
||||||
|
continue_without_prompting=0
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
### END OF CONFIGURATION ###
|
### END OF CONFIGURATION ###
|
||||||
########################################
|
########################################
|
||||||
|
@ -129,11 +132,18 @@ parse_flags() {
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
--i_understand_that_this_droplet_will_be_completely_wiped)
|
||||||
|
continue_without_prompting=1
|
||||||
|
conf_key=option_acknowledged
|
||||||
|
shift
|
||||||
|
break
|
||||||
|
;;
|
||||||
--help)
|
--help)
|
||||||
print_help_and_exit
|
print_help_and_exit
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
[ "${conf_key}" = option_acknowledged ] && continue
|
||||||
[ -n "${conf_key}" ] || fatal "Unknown option: $1"
|
[ -n "${conf_key}" ] || fatal "Unknown option: $1"
|
||||||
[ -n "${conf_val}" ] || fatal "Empty value for option ${conf_key}."
|
[ -n "${conf_val}" ] || fatal "Empty value for option ${conf_key}."
|
||||||
local -n conf_ref=${conf_key}
|
local -n conf_ref=${conf_key}
|
||||||
|
@ -206,6 +216,21 @@ sanity_checks() {
|
||||||
fatal "This script only supports Debian 8.x."
|
fatal "This script only supports Debian 8.x."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prompt_for_destruction() {
|
||||||
|
(( continue_without_prompting )) && return 0
|
||||||
|
log "*** ALL DATA ON THIS DROPLET WILL BE WIPED. ***"
|
||||||
|
log "Please backup all important data on this droplet before continuing."
|
||||||
|
log 'Type "wipe this droplet" to continue or anything else to cancel.'
|
||||||
|
local response
|
||||||
|
read -p ' > ' response
|
||||||
|
if [ "${response}" = "wipe this droplet" ]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
log "Cancelled."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
download_and_verify() {
|
download_and_verify() {
|
||||||
local file_url="$1"
|
local file_url="$1"
|
||||||
local local_path="$2"
|
local local_path="$2"
|
||||||
|
@ -764,6 +789,7 @@ if [ $$ -ne 1 ]; then
|
||||||
parse_flags "$@"
|
parse_flags "$@"
|
||||||
sanity_checks
|
sanity_checks
|
||||||
validate_flags_and_augment_globals
|
validate_flags_and_augment_globals
|
||||||
|
prompt_for_destruction
|
||||||
stage1_install
|
stage1_install
|
||||||
stage2_arrange
|
stage2_arrange
|
||||||
stage3_prepare
|
stage3_prepare
|
||||||
|
|
Loading…
Reference in New Issue