youtube-dl/update_latest.sh

23 lines
562 B
Bash
Executable File

#/bins/sh
set -e
version="$1"
if [ -z "$version" ]; then
echo "Usage: $0 version"
exit 1
fi
cd "$(dirname $(readlink -f $0))"
ln -sf --no-target-directory ../downloads/$version latest/directory
for f in $(ls "downloads/$version/"); do \
ln -sf --no-target-directory "../downloads/$version/$f" latest/$(echo $f | sed -e "s@-$version@@")
done
ln -sf --no-target-directory "$version" "downloads/latest"
/bin/echo -e "RewriteEngine On\nRewriteRule latest(.*) /downloads/${version}\$1 [L,R=302]" > downloads/.htaccess
echo -n "$version" > latest/version