nix: Make nix the root
Which means now I'll have to think about real prefixes in commit names.
This commit is contained in:
parent
550eed06e0
commit
ee178b7d57
190 changed files with 5 additions and 6 deletions
1
unprocessed/termux/.gitignore
vendored
Normal file
1
unprocessed/termux/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
colors.properties
|
2
unprocessed/termux/bin/.gitignore
vendored
Normal file
2
unprocessed/termux/bin/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
2
unprocessed/termux/boot/autosvc
Executable file
2
unprocessed/termux/boot/autosvc
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/data/data/com.termux/files/usr/bin/bash
|
||||
autosvc
|
4
unprocessed/termux/boot/symlink
Executable file
4
unprocessed/termux/boot/symlink
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/data/data/com.termux/files/usr/bin/bash
|
||||
echo "/system/bin/mount -o remount,rw /" | tsu
|
||||
echo "ln -s /data/data/com.termux/files/usr /usr" | tsu
|
||||
echo "/system/bin/mount -o remount,ro /" | tsu
|
BIN
unprocessed/termux/font.ttf
Normal file
BIN
unprocessed/termux/font.ttf
Normal file
Binary file not shown.
39
unprocessed/termux/scripts/autosvc
Executable file
39
unprocessed/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
unprocessed/termux/scripts/service
Executable file
22
unprocessed/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
unprocessed/termux/scripts/sudo
Executable file
11
unprocessed/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
|
6
unprocessed/termux/scripts/tsu.old
Executable file
6
unprocessed/termux/scripts/tsu.old
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/data/data/com.termux/files/usr/bin/env bash
|
||||
|
||||
# Force the passing of the environment variables on LineageOS where the --preserve-environment
|
||||
# option on the su binary doesn't seem to work well
|
||||
|
||||
/data/data/com.termux/files/usr/bin/tsu -s "$(env | sed "s/^\([^=]\+\)=\(.*\)/\1='\2'/" | tr '\n' ' ') $(which bash)"
|
3
unprocessed/termux/scripts/yt
Executable file
3
unprocessed/termux/scripts/yt
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/data/data/com.termux/files/usr/bin/env bash
|
||||
cd ~/storage/shared/Movies/NewPipe/
|
||||
youtube-dl --all-subs "${@: -1}"
|
59
unprocessed/termux/services/autosvc
Executable file
59
unprocessed/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
unprocessed/termux/services/crond
Executable file
59
unprocessed/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
unprocessed/termux/services/sshd
Executable file
59
unprocessed/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
unprocessed/termux/services/syncthing
Executable file
59
unprocessed/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" -home ~/.config/syncthing
|
||||
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 $?
|
59
unprocessed/termux/services/syncthing.user
Executable file
59
unprocessed/termux/services/syncthing.user
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: "
|
||||
start-stop-daemon -p "$PIDFILE" -x syncthing -S -b -N 5 -m -- -logfile="$LOGFILE" -home ~/.config/syncthing
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping Syncthing: "
|
||||
start-stop-daemon -p "$PIDFILE" -x syncthing -K
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
status() {
|
||||
printf "Syncthing: "
|
||||
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 $?
|
1
unprocessed/termux/shell
Symbolic link
1
unprocessed/termux/shell
Symbolic link
|
@ -0,0 +1 @@
|
|||
/data/data/com.termux/files/usr/bin/zsh
|
Loading…
Add table
Add a link
Reference in a new issue