Commit | Line | Data |
---|---|---|
59f0d218 FF |
1 | #!/system/bin/sh |
2 | ||
3 | set -e -u | |
4 | ||
5 | SCRIPTNAME=$0 | |
6 | show_usage () { | |
7 | echo "usage: $SCRIPTNAME [-s shell]" | |
8 | echo "Change the login shell." | |
9 | } | |
10 | ||
11 | set_shell () { | |
12 | mkdir -p $HOME/.termux | |
13 | NEW_SHELL=$1 | |
14 | if test -x $PREFIX/bin/$NEW_SHELL; then | |
15 | ln -f -s $PREFIX/bin/$NEW_SHELL $HOME/.termux/shell | |
16 | elif test -x $NEW_SHELL; then | |
17 | ln -f -s $NEW_SHELL $HOME/.termux/shell | |
18 | else | |
19 | echo "Error: $NEW_SHELL is not an executable file" | |
20 | fi | |
21 | } | |
22 | ||
23 | O=`getopt -l help -- hs: "$@"` | |
24 | eval set -- "$O" | |
25 | while true; do | |
26 | case "$1" in | |
27 | -h|--help) show_usage; exit 0;; | |
28 | -s) set_shell $2; exit 0;; | |
29 | --) shift; break;; | |
30 | *) echo Error; show_usage; exit 1;; | |
31 | esac | |
32 | done | |
33 | ||
34 | echo "Error: Specify shell with the -s flag" | |
35 | exit 1 |