mirror of
https://github.com/xdtianyu/scripts.git
synced 2025-08-08 20:00:54 +08:00
Create d2z.sh
This commit is contained in:
25
net/transmission/d2z.sh
Normal file
25
net/transmission/d2z.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
X2T=/etc/transmission-daemon/x2t.sh
|
||||
ARIA2_RPC=/etc/transmission-daemon/aria2-rpc.sh
|
||||
|
||||
export LC_ALL=en_US.UTF-8
|
||||
|
||||
if [ "$#" -eq 2 ]; then
|
||||
DIR=$(basename "$2")
|
||||
OPT="$1"
|
||||
else
|
||||
DIR=$(basename "$1")
|
||||
OPT="-o"
|
||||
fi
|
||||
|
||||
zip -r -0 "$DIR.zip" "$DIR"
|
||||
|
||||
if [ "$OPT" = "-z" ]; then
|
||||
mv "$DIR" "$DIR-tmp"
|
||||
$X2T -z "$DIR.zip"
|
||||
rm "$DIR.zip"
|
||||
mv "$DIR-tmp" "$DIR"
|
||||
else
|
||||
$ARIA2_RPC "$DIR.zip"
|
||||
fi
|
Reference in New Issue
Block a user