Merge branch 'master' of frogit:geoffrey/dotfiles
This commit is contained in:
commit
90b8d7b245
3
bashrc
3
bashrc
|
@ -15,6 +15,9 @@ export PATH="/usr/lib/ccache/bin/:$PATH"
|
|||
if [ -d $HOME/.gem/ruby/2.4.0/bin ]; then
|
||||
export PATH="$HOME/.gem/ruby/2.4.0/bin/:$PATH"
|
||||
fi
|
||||
if [ -d /data/data/com.termux/ ]; then
|
||||
export PATH="$HOME/.termux/scripts:$HOME/.termux/bin:$PATH"
|
||||
fi
|
||||
#export PATH="$(echo "$PATH" | sed 's|:|\n|g' | sort | uniq | tr '\n' ':' | sed 's|:$||')"
|
||||
export JAVA_FONTS=/usr/share/fonts/TTF
|
||||
export ANDROID_HOME=/opt/android-sdk
|
||||
|
|
|
@ -297,7 +297,7 @@ if [ $EXTRA == 1 ]; then
|
|||
inst cmake clang llvm npm
|
||||
|
||||
# Extra CLI
|
||||
inst sl ffmpeg youtube-dl optipng
|
||||
inst sl ffmpeg youtube-dl optipng syncthing
|
||||
|
||||
if [ $ARCH == 1 ]; then
|
||||
inst jq
|
||||
|
|
2
termux/bin/.gitignore
vendored
Normal file
2
termux/bin/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
2
termux/boot/autosvc
Executable file
2
termux/boot/autosvc
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/data/data/com.termux/files/usr/bin/bash
|
||||
autosvc
|
2
termux/boot/symlink
Executable file
2
termux/boot/symlink
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/data/data/com.termux/files/usr/bin/bash
|
||||
echo "ln -s /data/data/com.termux/files/usr /usr" | tsu
|
29
termux/colors.properties
Normal file
29
termux/colors.properties
Normal file
|
@ -0,0 +1,29 @@
|
|||
# https://github.com/chriskempson/base16-xresources/blob/master/base16-monokai.dark.256.xresources
|
||||
foreground= #f8f8f2
|
||||
background= #272822
|
||||
cursor= #f8f8f2
|
||||
|
||||
color0= #272822
|
||||
color1= #f92672
|
||||
color2= #a6e22e
|
||||
color3= #f4bf75
|
||||
color4= #66d9ef
|
||||
color5= #ae81ff
|
||||
color6= #a1efe4
|
||||
color7= #f8f8f2
|
||||
|
||||
color8= #75715e
|
||||
color9= #f92672
|
||||
color10= #a6e22e
|
||||
color11= #f4bf75
|
||||
color12= #66d9ef
|
||||
color13= #ae81ff
|
||||
color14= #a1efe4
|
||||
color15= #f9f8f5
|
||||
|
||||
color16= #fd971f
|
||||
color17= #ae81ff
|
||||
color18= #383830
|
||||
color19= #49483e
|
||||
color20= #a59f85
|
||||
color21= #f5f4f1
|
BIN
termux/font.ttf
Normal file
BIN
termux/font.ttf
Normal file
Binary file not shown.
39
termux/scripts/autosvc
Executable file
39
termux/scripts/autosvc
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/data/data/com.termux/files/usr/bin/bash
|
||||
#
|
||||
# Start services based on phone state
|
||||
#
|
||||
|
||||
function act() {
|
||||
# Services that should be always on
|
||||
|
||||
service sshd start
|
||||
service autosvc start
|
||||
|
||||
# Services that should be on depending on battery
|
||||
|
||||
bat="$(termux-battery-status | jq -r '.status')"
|
||||
|
||||
if [[ "$bat" == "FULL" || "$bat" == "CHARGING" ]]
|
||||
then
|
||||
service syncthing start
|
||||
else
|
||||
service syncthing stop
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$1" == "-d" ]
|
||||
then
|
||||
# Daemon mode
|
||||
while true
|
||||
do
|
||||
echo 29
|
||||
act &>> $HOME/.local/log/autosvc.log
|
||||
echo 31
|
||||
sleep 60
|
||||
done
|
||||
else
|
||||
# One shot mode
|
||||
# TODO Soft-code the log destination & the program arguments
|
||||
act
|
||||
fi
|
||||
|
22
termux/scripts/service
Executable file
22
termux/scripts/service
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/data/data/com.termux/files/usr/bin/bash
|
||||
#
|
||||
# Run & stop Termux services
|
||||
#
|
||||
|
||||
if [ $# -lt 1 ]
|
||||
then
|
||||
echo "Expected a service name as first argument."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
service="$1"
|
||||
file="$HOME/.termux/services/$1"
|
||||
|
||||
if [ -f "$file" ]
|
||||
then
|
||||
shift
|
||||
$file "$@"
|
||||
else
|
||||
echo "Service not found: $1"
|
||||
fi
|
||||
|
11
termux/scripts/sudo
Executable file
11
termux/scripts/sudo
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/data/data/com.termux/files/usr/bin/bash
|
||||
#
|
||||
# Substitution for sudo
|
||||
#
|
||||
|
||||
if [ "$(whoami)" != 'root' ]
|
||||
then
|
||||
echo "$@" | tsu
|
||||
else
|
||||
"$@"
|
||||
fi
|
59
termux/services/autosvc
Executable file
59
termux/services/autosvc
Executable file
|
@ -0,0 +1,59 @@
|
|||
#!/data/data/com.termux/files/usr/bin/bash
|
||||
#
|
||||
# Charge services based on phone state
|
||||
#
|
||||
|
||||
PIDFILE="$HOME/.local/run/autosvc.pid"
|
||||
LOGFILE="$HOME/.local/log/autosvc.log"
|
||||
|
||||
start() {
|
||||
printf "Starting autosvc: "
|
||||
start-stop-daemon -p "$PIDFILE" -x /data/data/com.termux/files/usr/bin/bash -S -b -m -- "$HOME/.termux/scripts/autosvc" -d -l "$LOGFILE"
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping autosvc: "
|
||||
start-stop-daemon -p "$PIDFILE" -x /data/data/com.termux/files/usr/bin/bash -K
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
status() {
|
||||
printf "autosvc: "
|
||||
PID="$(cat "$PIDFILE" 2> /dev/null)"
|
||||
if [[ -n "$PID" && -d "/proc/$PID" ]]
|
||||
then
|
||||
echo "running"
|
||||
else
|
||||
echo "stopped"
|
||||
fi
|
||||
}
|
||||
|
||||
log() {
|
||||
tail "$@" "$LOGFILE"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
log)
|
||||
shift
|
||||
log "$@"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|status|log}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
59
termux/services/crond
Executable file
59
termux/services/crond
Executable file
|
@ -0,0 +1,59 @@
|
|||
#!/data/data/com.termux/files/usr/bin/bash
|
||||
#
|
||||
# Start crond
|
||||
#
|
||||
|
||||
PIDFILE="$HOME/.local/run/crond.pid"
|
||||
LOGFILE="$HOME/.local/log/crond.log"
|
||||
|
||||
start() {
|
||||
printf "Starting crond: "
|
||||
start-stop-daemon -p "$PIDFILE" -x crond -S -b -m -- -f -L "$LOGFILE"
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping crond: "
|
||||
start-stop-daemon -p "$PIDFILE" -x crond -K
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
status() {
|
||||
printf "crond: "
|
||||
PID="$(cat "$PIDFILE" 2> /dev/null)"
|
||||
if [[ -n "$PID" && -d "/proc/$PID" ]]
|
||||
then
|
||||
echo "running"
|
||||
else
|
||||
echo "stopped"
|
||||
fi
|
||||
}
|
||||
|
||||
log() {
|
||||
tail "$@" "$LOGFILE"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
log)
|
||||
shift
|
||||
log "$@"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|status|log}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
59
termux/services/sshd
Executable file
59
termux/services/sshd
Executable file
|
@ -0,0 +1,59 @@
|
|||
#!/data/data/com.termux/files/usr/bin/bash
|
||||
#
|
||||
# Start SSH server daemon
|
||||
#
|
||||
|
||||
PIDFILE="/data/data/com.termux/files/usr/var/run/sshd.pid"
|
||||
LOGFILE="$HOME/.local/log/sshd.log"
|
||||
|
||||
start() {
|
||||
printf "Starting SSHD: "
|
||||
start-stop-daemon -p "$PIDFILE" -x sshd -S -- -E "$LOGFILE"
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping SSHD: "
|
||||
start-stop-daemon -p "$PIDFILE" -x sshd -K
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
status() {
|
||||
printf "SSHD: "
|
||||
PID="$(cat "$PIDFILE" 2> /dev/null)"
|
||||
if [[ -n "$PID" && -d "/proc/$PID" ]]
|
||||
then
|
||||
echo "running"
|
||||
else
|
||||
echo "stopped"
|
||||
fi
|
||||
}
|
||||
|
||||
log() {
|
||||
tail "$@" "$LOGFILE"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
log)
|
||||
shift
|
||||
log "$@"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|status|log}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
59
termux/services/syncthing
Executable file
59
termux/services/syncthing
Executable file
|
@ -0,0 +1,59 @@
|
|||
#!/data/data/com.termux/files/usr/bin/bash
|
||||
#
|
||||
# Start Syncthing synchronization service
|
||||
#
|
||||
|
||||
PIDFILE="$HOME/.local/run/syncthing.pid"
|
||||
LOGFILE="$HOME/.local/log/syncthing.log"
|
||||
|
||||
start() {
|
||||
printf "Starting Syncthing: "
|
||||
sudo start-stop-daemon -p "$PIDFILE" -x syncthing -S -b -N 5 -m -- -logfile="$LOGFILE"
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping Syncthing: "
|
||||
sudo start-stop-daemon -p "$PIDFILE" -x syncthing -K
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
status() {
|
||||
printf "Syncthing: "
|
||||
PID="$(sudo cat "$PIDFILE" 2> /dev/null)"
|
||||
if [[ -n "$PID" && -d "/proc/$PID" ]]
|
||||
then
|
||||
echo "running"
|
||||
else
|
||||
echo "stopped"
|
||||
fi
|
||||
}
|
||||
|
||||
log() {
|
||||
sudo tail "$@" "$LOGFILE"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
log)
|
||||
shift
|
||||
log "$@"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|status|log}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
Loading…
Reference in a new issue