improve android script

This commit is contained in:
ed 2019-06-13 13:22:36 +00:00
parent 88c43bb60a
commit 2075780a93
2 changed files with 18 additions and 17 deletions

View file

@ -65,7 +65,6 @@ roughly sorted by priority
* permissions break for `ed` on `-v /home/ed/vfs:moji:r -v /home/ed/inc:inc:r:aed` * permissions break for `ed` on `-v /home/ed/vfs:moji:r -v /home/ed/inc:inc:r:aed`
* http error handling (conn.status or handler-retval) * http error handling (conn.status or handler-retval)
* look into android thumbnail cache file format * look into android thumbnail cache file format
* run-script for android
* last-modified header * last-modified header
* support pillow-simd * support pillow-simd
* figure out the deal with pixel3a not being connectable as hotspot * figure out the deal with pixel3a not being connectable as hotspot

View file

@ -1,10 +1,11 @@
#!/bin/bash #!/bin/bash
set -e set -e
msg() { printf '\n\033[1;30m>\033[0;33m>\033[1m>\033[0m %s\n' "$1" >&2; } _msg() { printf "$2"'\033[1;30m>\033[0;33m>\033[1m>\033[0m %s\n' "$1" >&2; }
imsg() { _msg "$1" ''; }
msg() { _msg "$1" \\n; }
mkdir -p ~/src mkdir -p ~/src
cd ~/src
## ##
## helper which installs termux packages ## helper which installs termux packages
@ -26,16 +27,17 @@ addpkg() {
## ##
## ensure git and copyparty is available ## ensure git and copyparty is available
[ -e copyparty/.ok ] || { [ -e ~/src/copyparty/.ok ] || {
command -v git >/dev/null || command -v git >/dev/null ||
addpkg git addpkg git
# in case of partial clone
rm -rf copyparty
msg "downloading copyparty from github" msg "downloading copyparty from github"
(
cd ~/src
rm -rf copyparty
git clone https://github.com/9001/copyparty git clone https://github.com/9001/copyparty
touch copyparty/.ok touch copyparty/.ok
)
} }
## ##
@ -47,9 +49,8 @@ command -v python3 >/dev/null ||
## ##
## ensure virtualenv and dependencies are available ## ensure virtualenv and dependencies are available
cd ~/src/copyparty [ -e ~/src/copyparty/.env/.ok ] || { (
cd ~/src/copyparty
[ -e .env/.ok ] || {
rm -rf .env rm -rf .env
msg "creating python3 virtualenv" msg "creating python3 virtualenv"
@ -60,7 +61,8 @@ cd ~/src/copyparty
pip install jinja2 pip install jinja2
deactivate deactivate
} touch .env/.ok
) }
## ##
## add copyparty alias to bashrc ## add copyparty alias to bashrc
@ -73,9 +75,9 @@ grep -qE '^alias copyparty=' ~/.bashrc 2>/dev/null || {
## ##
## start copyparty ## start copyparty
msg "activating virtualenv" imsg "activating virtualenv"
. .env/bin/activate . ~/src/copyparty/.env/bin/activate
msg "starting copyparty" imsg "starting copyparty"
python3 -m copyparty "$@" PYTHONPATH=~/src/copyparty python3 -m copyparty "$@"