Browse Source

termux-tools: Improve the chsh command

android-5
Fredrik Fornwall 10 years ago
parent
commit
da9d85783c
  1. 2
      packages/termux-tools/build.sh
  2. 25
      packages/termux-tools/chsh

2
packages/termux-tools/build.sh

@ -1,6 +1,6 @@
TERMUX_PKG_HOMEPAGE=http://termux.com/ TERMUX_PKG_HOMEPAGE=http://termux.com/
TERMUX_PKG_DESCRIPTION="Some tools for Termux" TERMUX_PKG_DESCRIPTION="Some tools for Termux"
TERMUX_PKG_VERSION=0.7 TERMUX_PKG_VERSION=0.10
termux_step_make_install () { termux_step_make_install () {
$CXX $CFLAGS $LDFLAGS -std=c++14 -Wall -Wextra -pedantic -Werror $TERMUX_PKG_BUILDER_DIR/*.cpp -o $TERMUX_PREFIX/bin/termux-elf-cleaner $CXX $CFLAGS $LDFLAGS -std=c++14 -Wall -Wextra -pedantic -Werror $TERMUX_PKG_BUILDER_DIR/*.cpp -o $TERMUX_PREFIX/bin/termux-elf-cleaner

25
packages/termux-tools/chsh

@ -1,22 +1,19 @@
#!/system/bin/sh #!/bin/sh
set -e -u set -e -u
SCRIPTNAME=$0
show_usage () { show_usage () {
echo "usage: $SCRIPTNAME [-s shell]" echo "usage: chsh [-s shell]"
echo "Change the login shell." echo "Change the login shell."
} }
set_shell () { set_shell () {
mkdir -p $HOME/.termux mkdir -p $HOME/.termux
NEW_SHELL=$1 NEW_SHELL=$PREFIX/bin/$1
if test -x $PREFIX/bin/$NEW_SHELL; then if test -x $NEW_SHELL -a ! -d $NEW_SHELL; then
ln -f -s $PREFIX/bin/$NEW_SHELL $HOME/.termux/shell
elif test -x $NEW_SHELL; then
ln -f -s $NEW_SHELL $HOME/.termux/shell ln -f -s $NEW_SHELL $HOME/.termux/shell
else else
echo "Error: $NEW_SHELL is not an executable file" echo "$NEW_SHELL is not an executable file!"
fi fi
} }
@ -31,5 +28,13 @@ while true; do
esac esac
done done
echo "Error: Specify shell with the -s flag" DEFAULT_SHELL=bash
exit 1 if [ ! -x $PREFIX/bin/$DEFAULT_SHELL ]; then DEFAULT_SHELL=ash; fi
echo Changing the login shell
echo Enter the new value, or press ENTER for the default
printf " Login Shell [$DEFAULT_SHELL]: "
read shell
if [ -z "$shell" ]; then shell=$DEFAULT_SHELL; fi
set_shell $shell

Loading…
Cancel
Save