forked from BodgeMaster/void-usb
system-image: improve comments and minor change to user message
parent
c1c2a8239c
commit
4b6926c004
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# used to work around cases where stdin is unavailable or not a terminal
|
# work around situations where stdin is unavailable or not a terminal
|
||||||
if bash -c ': > /dev/tty' > /dev/null 2>&1; then
|
if bash -c ': > /dev/tty' > /dev/null 2>&1; then
|
||||||
TTY_OR_CONSOLE="/dev/tty"
|
TTY_OR_CONSOLE="/dev/tty"
|
||||||
else
|
else
|
||||||
|
@ -22,10 +22,12 @@ function yesno {
|
||||||
read -p "[y/n] " -n1 DISCARD_ME < $TTY_OR_CONSOLE > $TTY_OR_CONSOLE
|
read -p "[y/n] " -n1 DISCARD_ME < $TTY_OR_CONSOLE > $TTY_OR_CONSOLE
|
||||||
case "$DISCARD_ME" in
|
case "$DISCARD_ME" in
|
||||||
y)
|
y)
|
||||||
|
# add a line break
|
||||||
echo_tty
|
echo_tty
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
n)
|
n)
|
||||||
|
# add a line break
|
||||||
echo_tty
|
echo_tty
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
|
@ -44,7 +46,10 @@ if [ "$1" = "--yes" ]; then
|
||||||
else
|
else
|
||||||
DONT_ASK="false"
|
DONT_ASK="false"
|
||||||
|
|
||||||
|
#TODO: use a bright color for ==== and the question
|
||||||
|
echo_tty "=========================="
|
||||||
echo_tty "Create a new system image?"
|
echo_tty "Create a new system image?"
|
||||||
|
echo_tty "=========================="
|
||||||
echo_tty
|
echo_tty
|
||||||
echo_tty "This will replace the existing system image with a snapshot of the currently"
|
echo_tty "This will replace the existing system image with a snapshot of the currently"
|
||||||
echo_tty "running system. Choosing no here will discard any newly installed programs,"
|
echo_tty "running system. Choosing no here will discard any newly installed programs,"
|
||||||
|
@ -57,8 +62,6 @@ else
|
||||||
echo_tty
|
echo_tty
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#TODO: colors (bright white / light gray for readability)
|
|
||||||
|
|
||||||
if $DONT_ASK || yesno; then
|
if $DONT_ASK || yesno; then
|
||||||
echo_tty -n "Generating exclusion list... "
|
echo_tty -n "Generating exclusion list... "
|
||||||
# cutting off the leading slash allows us to just ignore empty lines below
|
# cutting off the leading slash allows us to just ignore empty lines below
|
||||||
|
@ -68,6 +71,7 @@ if $DONT_ASK || yesno; then
|
||||||
|
|
||||||
for I in ${!MOUNT_LIST[@]}; do
|
for I in ${!MOUNT_LIST[@]}; do
|
||||||
if [ ! -z "${MOUNT_LIST[$I]}" ]; then
|
if [ ! -z "${MOUNT_LIST[$I]}" ]; then
|
||||||
|
# check if a parent of ${MOUNT_LIST[$I]} is already in $EXCLUDE_LIST
|
||||||
FOUND=0
|
FOUND=0
|
||||||
for J in ${!EXCLUDE_LIST[@]}; do
|
for J in ${!EXCLUDE_LIST[@]}; do
|
||||||
if grep "${EXCLUDE_LIST[$J]}" > /dev/null <<< "${MOUNT_LIST[$I]}"; then
|
if grep "${EXCLUDE_LIST[$J]}" > /dev/null <<< "${MOUNT_LIST[$I]}"; then
|
||||||
|
|
Loading…
Reference in New Issue