27 lines
466 B
Bash
Executable file
27 lines
466 B
Bash
Executable file
#!/bin/sh -e
|
|
|
|
file="$1"
|
|
host=staticweb.ungleich.ch
|
|
dir=/home/services/www/nico/www.nico.schottelius.org/www/temp
|
|
url="https://www.nico.schottelius.org/temp"
|
|
|
|
delete_after=""
|
|
|
|
[ -z "$file" ] && exit 1
|
|
|
|
if [ "$file" = "-" ]; then
|
|
file=$(mktemp)
|
|
cat > "$file"
|
|
delete_after=yes
|
|
fi
|
|
|
|
bfile="$(basename "$file")"
|
|
|
|
scp -r "$file" "${host}:${dir}"
|
|
ssh "$host" "chmod a+r \"$dir/$bfile\""
|
|
|
|
if [ "$delete_after" ]; then
|
|
rm -f "$file"
|
|
fi
|
|
|
|
echo "${url}/${bfile}"
|