Skip to content

Instantly share code, notes, and snippets.

@iGlitch
Last active May 12, 2022 06:14
Show Gist options
  • Save iGlitch/e91ae87ffdc6619283684aa5ffdd247a to your computer and use it in GitHub Desktop.
Save iGlitch/e91ae87ffdc6619283684aa5ffdd247a to your computer and use it in GitHub Desktop.
OpenWRT iStore English "Installer"
#!/bin/sh
# iStore English Patcher by Glitch
echo "Welcome to the iStore English Patcher"
echo "What do you want to do?"
echo "1. Make iStore English"
echo "2. Revert to Chinese iStore"
#echo "3. Make iStore Dark Theme"
#echo "4. Restore iStore's Original Theme"
echo "3. Exit"
read n
case $n in
1)
if [[ -f "/www/luci-static/istore/index.js" ]]; then
if [[ ! -f "/www/luci-static/istore/index.js.bak" ]]; then
echo "Backing up original Chinese files..."
mv /www/luci-static/istore/index.js /www/luci-static/istore/index.js.bak
mv /usr/lib/lua/luci/view/store/main.htm /usr/lib/lua/luci/view/store/main.htm.bak
fi
echo "Downloading English files..."
if [[ -f "/usr/bin/wget" ]]; then
wget -q -O /www/luci-static/istore/index.js https://glitchery.jp/istore/index.js
wget -q -O /usr/lib/lua/luci/view/store/main.htm https://glitchery.jp/istore/main.htm
else
curl -s -o /www/luci-static/istore/index.js https://glitchery.jp/istore/index.js
curl -s -o /usr/lib/lua/luci/view/store/main.htm https://glitchery.jp/istore/main.htm
fi
if [[ -f "/overlay/upper/usr/lib/lua/luci/view/store/main.htm" ]]; then
mv /overlay/upper/usr/lib/lua/luci/view/store/main.htm /overlay/upper/usr/lib/lua/luci/view/store/main.htm.bak
cp /usr/lib/lua/luci/view/store/main.htm /overlay/upper/usr/lib/lua/luci/view/store/main.htm
fi
echo "Download complete, you may now enjoy English iStore"
else echo "iStore files not found, perhaps iStore isn't installed or you changed its default path?"
fi ;;
2) if [[ ! -f "/www/luci-static/istore/index.js.bak" ]]; then
echo "Your iStore is already in Chinese/Nothing to revert." exit
fi
if [[ -f "/www/luci-static/istore/index.js.bak" ]]; then
echo "Reverting iStore to Chinese..."
rm -f /www/luci-static/istore/index.js
mv /www/luci-static/istore/index.js.bak /www/luci-static/istore/index.js
fi
if [[ -f "/usr/lib/lua/luci/view/store/main.htm.bak" ]]; then
rm -f /usr/lib/lua/luci/view/store/main.htm
mv /usr/lib/lua/luci/view/store/main.htm.bak /usr/lib/lua/luci/view/store/main.htm
mv /overlay/upper/usr/lib/lua/luci/view/store/main.htm.bak /overlay/upper/usr/lib/lua/luci/view/store/main.htm
fi
echo "iStore is now back to Chinese, goodbye" ;;
#3) if [[ -f "/www/luci-static/istore/style.css" ]]; then
# if [[ ! -f "/www/luci-static/istore/style.css.bak" ]]; then
# echo "Backing up light files..."
# mv /www/luci-static/istore/style.css /www/luci-static/istore/style.css.bak
# fi
# echo "Downloading dark theme..."
# if [[ -f "/usr/bin/wget" ]]; then
# wget -q -O /www/luci-static/istore/style.css https://glitchery.jp/istore/style.css
# else
# curl -s -o /www/luci-static/istore/style.css https://glitchery.jp/istore/style.css
# fi
# else echo "Style.css not found"
# fi ;;
#4) if [[ -f "/www/luci-static/istore/style.css.bak" ]]; then
# echo "Reverting light theme..."
# rm -f /www/luci-static/istore/style.css
# mv /www/luci-static/istore/style.css.bak /www/luci-static/istore/style.css
# else echo "Backup not found, no stylesheet to revert (are you already on light theme?)"
# fi ;;
3) echo "Goodbye.";;
*) echo "Invalid option, please follow instructions.";;
esac
@jannson
Copy link

jannson commented May 11, 2022

You are great !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment