2020-06-01 20:23:30 +03:00
|
|
|
#!/bin/bash
|
2015-12-27 19:53:30 -05:00
|
|
|
|
|
|
|
if [ "$#" != "0" ]; then
|
2017-01-03 17:21:43 -05:00
|
|
|
echo 'usage: termux-setup-storage'
|
|
|
|
echo 'Use without arguments to ensure storage permission granted'
|
|
|
|
echo 'and symlinks to storage available in $HOME/storage'
|
|
|
|
exit
|
2015-12-27 19:53:30 -05:00
|
|
|
fi
|
|
|
|
|
2020-06-01 20:23:30 +03:00
|
|
|
if [ -d "@TERMUX_HOME@/storage" ]; then
|
2021-10-13 14:02:25 +03:00
|
|
|
cat <<- EOF
|
|
|
|
|
|
|
|
It appears that directory '~/storage' already exists.
|
|
|
|
This script is going to rebuild its structure from
|
|
|
|
scratch, wiping all dangling files. The actual storage
|
|
|
|
content IS NOT going to be deleted.
|
|
|
|
|
|
|
|
EOF
|
|
|
|
read -re -p "Do you want to continue? (y/n) " CHOICE
|
2020-06-01 20:23:30 +03:00
|
|
|
|
|
|
|
if ! [[ "${CHOICE}" =~ (Y|y) ]]; then
|
2021-10-13 14:02:25 +03:00
|
|
|
echo "Aborting configuration and leaving directory '~/storage' intact."
|
2020-06-01 20:23:30 +03:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2016-04-10 20:20:17 -04:00
|
|
|
am broadcast --user 0 \
|
2015-12-27 19:53:30 -05:00
|
|
|
--es com.termux.app.reload_style storage \
|
|
|
|
-a com.termux.app.reload_style com.termux > /dev/null
|