Browse Source

termux-api: Cleanup and put termux-api binary in libexec

android-5
Fredrik Fornwall 9 years ago
parent
commit
cc1ae02e2e
  1. 11
      packages/termux-api/build.sh
  2. 4
      packages/termux-api/termux-battery-status
  3. 4
      packages/termux-api/termux-camera-info
  4. 4
      packages/termux-api/termux-camera-photo
  5. 4
      packages/termux-api/termux-clipboard-get
  6. 4
      packages/termux-api/termux-clipboard-set
  7. 6
      packages/termux-api/termux-contact-list
  8. 4
      packages/termux-api/termux-dialog
  9. 4
      packages/termux-api/termux-download
  10. 4
      packages/termux-api/termux-location
  11. 4
      packages/termux-api/termux-notification
  12. 4
      packages/termux-api/termux-share
  13. 4
      packages/termux-api/termux-sms-inbox
  14. 2
      packages/termux-api/termux-sms-send
  15. 4
      packages/termux-api/termux-toast
  16. 4
      packages/termux-api/termux-tts-engines
  17. 4
      packages/termux-api/termux-tts-speak
  18. 4
      packages/termux-api/termux-vibrate

11
packages/termux-api/build.sh

@ -1,11 +1,14 @@
TERMUX_PKG_HOMEPAGE=http://termux.com/add-ons/api/
TERMUX_PKG_DESCRIPTION="Termux API commands"
TERMUX_PKG_VERSION=0.7
TERMUX_PKG_VERSION=0.8
termux_step_make_install () {
mkdir -p $TERMUX_PREFIX/bin
for file in `ls $TERMUX_PKG_BUILDER_DIR/* | grep -v build.sh | grep -v termux-api.c`; do
cp $file $TERMUX_PREFIX/bin
local TERMUX_API_BINARY=$TERMUX_PREFIX/libexec/termux-api
cd $TERMUX_PKG_BUILDER_DIR
for file in `ls termux-* | grep -v termux-api.c`; do
sed "s|@TERMUX_API@|$TERMUX_API_BINARY|" $file > $TERMUX_PREFIX/bin/$file
chmod +x $TERMUX_PREFIX/bin/$file
done
$CC $CFLAGS -std=c11 -Wall -Wextra -pedantic -Werror $LDFLAGS $TERMUX_PKG_BUILDER_DIR/termux-api.c -o $TERMUX_PREFIX/bin/termux-api
$CC $CFLAGS -std=c11 -Wall -Wextra -pedantic -Werror $LDFLAGS termux-api.c -o $TERMUX_API_BINARY
}

4
packages/termux-api/termux-battery-status

@ -1,4 +1,4 @@
#!/system/bin/sh
#!/bin/sh
if [ "$#" != "0" ]; then
echo "usage: termux-battery-status"
@ -6,4 +6,4 @@ if [ "$#" != "0" ]; then
exit 1
fi
termux-api BatteryStatus
@TERMUX_API@ BatteryStatus

4
packages/termux-api/termux-camera-info

@ -1,3 +1,3 @@
#!/system/bin/sh
#!/bin/sh
termux-api CameraInfo
@TERMUX_API@ CameraInfo

4
packages/termux-api/termux-camera-photo

@ -1,4 +1,4 @@
#!/system/bin/sh
#!/bin/sh
set -e -u
@ -28,4 +28,4 @@ if [ $# != 1 ]; then show_usage; exit 1; fi
touch $1
PARAMS="$PARAMS --es file `realpath $1`"
termux-api CameraPhoto $PARAMS
@TERMUX_API@ CameraPhoto $PARAMS

4
packages/termux-api/termux-clipboard-get

@ -1,3 +1,3 @@
#!/system/bin/sh
#!/bin/sh
termux-api Clipboard
@TERMUX_API@ Clipboard

4
packages/termux-api/termux-clipboard-set

@ -1,4 +1,4 @@
#!/system/bin/sh
#!/bin/sh
TEXT=`cat -`
termux-api Clipboard --es text "$TEXT"
@TERMUX_API@ Clipboard --es text "$TEXT"

6
packages/termux-api/termux-contact-list

@ -1,10 +1,10 @@
#!/system/bin/sh
#!/bin/sh
set -e -u
if [ "$#" != "0" ]; then
echo "usage: termux-contact-list"
echo "List all contacts."
exit 1
exit
fi
termux-api ContactList
@TERMUX_API@ ContactList

4
packages/termux-api/termux-dialog

@ -1,4 +1,4 @@
#!/system/bin/sh
#!/bin/sh
set -e -u
@ -25,4 +25,4 @@ done
# Too many arguments:
if [ $# != 0 ]; then show_usage; exit 1; fi
eval termux-api Dialog $PARAMS
eval @TERMUX_API@ Dialog $PARAMS

4
packages/termux-api/termux-download

@ -1,4 +1,4 @@
#!/system/bin/sh
#!/bin/sh
set -e -u
@ -27,4 +27,4 @@ done
# Too many arguments:
if [ $# != 1 ]; then show_usage; exit 1; fi
eval termux-api Download $PARAMS $1
eval @TERMUX_API@ Download $PARAMS $1

4
packages/termux-api/termux-location

@ -1,4 +1,4 @@
#!/system/bin/sh
#!/bin/sh
set -e -u
PARAMS=""
@ -25,4 +25,4 @@ done
# Too many arguments:
if [ $# != 0 ]; then show_usage; exit 1; fi
termux-api Location $PARAMS
@TERMUX_API@ Location $PARAMS

4
packages/termux-api/termux-notification

@ -1,4 +1,4 @@
#!/system/bin/sh
#!/bin/sh
set -u
@ -35,4 +35,4 @@ if [ $CONTENT_OR_TITLE_SET = "no" ]; then
exit 1;
fi;
termux-api Notification $PARAMS
@TERMUX_API@ Notification $PARAMS

4
packages/termux-api/termux-share

@ -1,4 +1,4 @@
#!/system/bin/sh
#!/bin/sh
show_usage () {
echo "usage: termux-share [options] [file]"
@ -45,4 +45,4 @@ done
if [ $# -gt 1 ]; then echo "Only one file can be shared"; exit 1; fi
if [ $# != 0 ]; then PARAMS="$PARAMS --es file `realpath $1`"; fi
termux-api Share $PARAMS
@TERMUX_API@ Share $PARAMS

4
packages/termux-api/termux-sms-inbox

@ -1,4 +1,4 @@
#!/system/bin/sh
#!/bin/sh
set -u
PARAM_LIMIT=10
@ -37,4 +37,4 @@ if [ $# != 0 ]; then show_usage; exit 1; fi
PARAMS="$PARAMS --ei offset $PARAM_OFFSET --ei limit $PARAM_LIMIT"
termux-api SmsInbox $PARAMS
@TERMUX_API@ SmsInbox $PARAMS

2
packages/termux-api/termux-sms-send

@ -7,4 +7,4 @@ if [ $# != 1 -o $1 = "-h" ]; then
exit 1
fi
termux-api SmsSend --es recipient $1
@TERMUX_API@ SmsSend --es recipient $1

4
packages/termux-api/termux-toast

@ -1,4 +1,4 @@
#!/system/bin/sh
#!/bin/sh
show_usage () {
echo "usage: termux-toast [-s|--short]"
@ -21,4 +21,4 @@ done
if [ $# != 0 ]; then show_usage; exit 1; fi
termux-api Toast $PARAMS
@TERMUX_API@ Toast $PARAMS

4
packages/termux-api/termux-tts-engines

@ -1,3 +1,3 @@
#!/system/bin/sh
#!/bin/sh
termux-api TextToSpeech --es engine LIST_AVAILABLE
@TERMUX_API@ TextToSpeech --es engine LIST_AVAILABLE

4
packages/termux-api/termux-tts-speak

@ -1,4 +1,4 @@
#!/system/bin/sh
#!/bin/sh
set -u
@ -30,4 +30,4 @@ case "$1" in
esac
done
termux-api TextToSpeech $PARAMS
@TERMUX_API@ TextToSpeech $PARAMS

4
packages/termux-api/termux-vibrate

@ -1,4 +1,4 @@
#!/system/bin/sh
#!/bin/sh
set -e -u
@ -20,4 +20,4 @@ case "$1" in
esac
done
termux-api Vibrate $PARAM_DURATION
@TERMUX_API@ Vibrate $PARAM_DURATION

Loading…
Cancel
Save