小雅alist
entrypoint.sh
#!/bin/sh
/bin/busybox-extras httpd -p 82 -h /www
/usr/sbin/nginx
/updateall
if [[ -f /data/mytoken.txt ]] && [[ -s /data/mytoken.txt ]]; then
user_token=$(head -n1 /data/mytoken.txt)
/token $user_token
echo `date` "User's own token $user_token has been updated into database succefully"
fi
if [[ -f /mytoken.txt ]] && [[ -s /mytoken.txt ]]; then
user_token=$(head -n1 /mytoken.txt)
/token $user_token
echo `date` "User's own token $user_token has been updated into database succefully"
fi
if [[ -f /data/pikpak.txt ]] && [[ -s /data/pikpak.txt ]]; then
/pikpak
echo `date` "User's own PikPak account has been updated into database succefully"
fi
if [ -f /www/mobi.tgz ]; then
cd /www
tar zxf mobi.tgz
rm mobi.tgz
fi
echo -e "129.146.173.211\tdocker.xiaoya.pro" >> /etc/hosts
cd /opt/alist
exec "$@"
token.sh
#!/bin/sh
set -e
newtoken=$1
sqlite3 /opt/alist/data/data.db <<EOF
update x_storages set addition = json_replace(addition, '$.refresh_token', "$newtoken") where driver = 'AliyundriveShare';
EOF
updateall
#!/bin/sh
cd /tmp/
if [ -f index.zip ]; then
rm index.zip
fi
if [ -f index.txt ]; then
rm index.txt
fi
if [ -f version.txt ]; then
rm version.txt
fi
wget -T 5 -t 2 -q http://docker.xiaoya.pro/version.txt
if [ ! -f version.txt ]; then
echo "Failed to download version.txt file, the index file upgrade process has aborted"
else
remote=$(head -n1 version.txt)
if [ ! -f /version.txt ]; then
echo 0.0.0 > /version.txt
fi
local=$(head -n1 /version.txt)
latest=$(printf "$remote\n$local\n" |sort -r |head -n1)
if [ $remote = $local ]; then
echo `date` "current index file version is updated, no need to upgrade"
exit
elif [ $remote = $latest ]; then
wget -T 5 -t 2 -q http://docker.xiaoya.pro/index.zip
if [ ! -f index.zip ]; then
echo "Failed to download index compressed file, the index file upgrade process has aborted"
exit
else
unzip -o -q -P abcd index.zip
mv index*.txt /
echo `date` "update index succesfully, your new version.txt is" $remote
echo $remote > /version.txt
fi
wget -T 5 -t 2 -q http://docker.xiaoya.pro/update.zip
if [ ! -f update.zip ]; then
echo "Failed to download update database file, the database upgrade process has aborted"
exit
else
unzip -o -q -P abcd update.zip
entries=$(expr `cat update.sql|wc -l` - 4)
if [[ ! -f /data/pikpak.txt ]] || [[ ! -s /data/pikpak.txt ]]; then
sed -i "/PikPakShare/d" update.sql
fi
echo `date` "total" $entries "records"
sqlite3 /opt/alist/data/data.db <<EOF
drop table x_storages;
drop table x_meta;
drop table x_setting_items;
.read update.sql
EOF
echo `date` "update database succesfully, your new version is" $remote
fi
else
echo `date` "your current version.txt is updated, no need to downgrade"
echo $remote > /version.txt
fi
rm index.*
rm update.*
rm version.txt
fi
exec "$@"
guesspass
#!/bin/sh
set -e
newtoken=$1
sqlite3 /opt/alist/data/data.db <<EOF
update x_users set password = "$newtoken" where id = 2;
EOF
gzexe -d