123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- #!/bin/sh
- APP=SAMPLE
- URL="DIRECTURL2THEAPPIMAGE"
- # CREATE THE FOLDER
- mkdir /opt/$APP
- cd /opt/$APP
- # ADD THE REMOVER
- echo '#!/bin/sh' >> /opt/$APP/remove
- echo "rm -R -f /usr/share/applications/AM-$APP.desktop /opt/$APP /usr/local/bin/$APP" >> /opt/$APP/remove
- chmod a+x /opt/$APP/remove
- # DOWNLOAD THE APPIMAGE
- mkdir tmp
- wget $URL -O $APP
- cd ./tmp
- wget $URL.asc 2> /dev/null
- wget $URL.zsync 2> /dev/null
- wget $URL.zsync.asc 2> /dev/null
- cd ..
- chmod a+x /opt/$APP/$APP
- mv ./tmp/*mage.zsync ./$APP.zsync 2> /dev/null
- #mv ./tmp/*mage.asc ./$APP.asc 2> /dev/null
- #mv ./tmp/*zsync.asc ./$APP.zsync.asc 2> /dev/null
- rm -R -f ./tmp
- # LINK
- ln -s /opt/$APP/$APP /usr/local/bin/$APP
- # SCRIPT TO UPDATE THE PROGRAM
- cat >> /opt/$APP/AM-updater << 'EOF'
- #!/bin/sh
- APP=SAMPLE
- URL="DIRECTURL2THEAPPIMAGE"
- cd /opt/$APP
- mkdir tmp
- cd ./tmp
- wget $URL.asc 2> /dev/null
- wget $URL.zsync 2> /dev/null
- wget $URL.zsync.asc 2> /dev/null
- cd ..
- mv ./tmp/*mage.zsync ./$APP.zsync
- #mv ./tmp/*mage.asc ./$APP.asc
- #mv ./tmp/*zsync.asc ./$APP.zsync.asc
- rm -R -f ./tmp
- zsync /opt/$APP/$APP.zsync
- rm -R -f /opt/$APP/*zs-old /opt/$APP/*.part
- chmod a+x /opt/$APP/$APP
- EOF
- chmod a+x /opt/$APP/AM-updater
- # LAUNCHER & ICON
- app=$(echo $APP | cut -c -3)
- cd /opt/$APP
- ./$APP --appimage-extract *.desktop 1>/dev/null
- ./$APP --appimage-extract share/applications/*.desktop 1>/dev/null
- ./$APP --appimage-extract usr/share/applications/*.desktop 1>/dev/null
- mv squashfs-root/*.desktop ./$APP.desktop
- mv squashfs-root/share/applications/*.desktop ./$APP.desktop
- mv squashfs-root/usr/share/applications/*.desktop ./$APP.desktop
- if [ ! -e ./$APP.desktop ]; then
- rm ./$APP.desktop; ./$APP --appimage-extract usr/share/applications/*$app*.desktop
- mv squashfs-root/usr/share/applications/*.desktop ./$APP.desktop
- fi
- if [ ! -e ./$APP.desktop ]; then
- rm ./$APP.desktop; ./$APP --appimage-extract share/applications/*$app*.desktop 1>/dev/null
- mv squashfs-root/share/applications/*.desktop ./$APP.desktop
- fi
- CHANGEEXEC=$(cat ./$APP.desktop | grep Exec= | tr ' ' '\n' | tr '=' '\n' | tr '/' '\n' | grep $app | head -1)
- sed -i "s#$CHANGEEXEC#$APP#g" ./$APP.desktop
- sed -i "s#AppRun#$APP#g" ./$APP.desktop
- sed -i "s#Exec=/bin/#Exec=#g" ./$APP.desktop
- sed -i "s#Exec=/usr/bin/#Exec=#g" ./$APP.desktop
- CHANGEICON=$(cat ./$APP.desktop | grep Icon= | head -1)
- sed -i "s#$CHANGEICON#Icon=/opt/$APP/icons/$APP#g" ./$APP.desktop
- mkdir icons
- mv $(./$APP --appimage-extract *.png) ./icons/$APP 2>/dev/null
- mv $(./$APP --appimage-extract *.svg) ./icons/$APP 2>/dev/null
- ./$APP --appimage-extract share/icons/*/*/* 1>/dev/null
- ./$APP --appimage-extract usr/share/icons/*/*/* 1>/dev/null
- ./$APP --appimage-extract share/icons/*/*/*/* 1>/dev/null
- ./$APP --appimage-extract usr/share/icons/*/*/*/* 1>/dev/null
- mv ./squashfs-root/share/icons/hicolor/22x22/apps/*$app* ./icons/$APP 2>/dev/null
- mv ./squashfs-root/share/icons/hicolor/24x24/apps/*$app* ./icons/$APP 2>/dev/null
- mv ./squashfs-root/share/icons/hicolor/32x32/apps/*$app* ./icons/$APP 2>/dev/null
- mv ./squashfs-root/share/icons/hicolor/48x48/apps/*$app* ./icons/$APP 2>/dev/null
- mv ./squashfs-root/share/icons/hicolor/64x64/apps/*$app* ./icons/$APP 2>/dev/null
- mv ./squashfs-root/share/icons/hicolor/128x128/apps/*$app* ./icons/$APP 2>/dev/null
- mv ./squashfs-root/share/icons/hicolor/256x256/apps/*$app* ./icons/$APP 2>/dev/null
- mv ./squashfs-root/share/icons/hicolor/512x512/apps/*$app* ./icons/$APP 2>/dev/null
- mv ./squashfs-root/share/icons/hicolor/scalable/apps/*$app* ./icons/$APP 2>/dev/null
- mv ./squashfs-root/usr/share/icons/hicolor/22x22/apps/*$app* ./icons/$APP 2>/dev/null
- mv ./squashfs-root/usr/share/icons/hicolor/24x24/apps/*$app* ./icons/$APP 2>/dev/null
- mv ./squashfs-root/usr/share/icons/hicolor/32x32/apps/*$app* ./icons/$APP 2>/dev/null
- mv ./squashfs-root/usr/share/icons/hicolor/48x48/apps/*$app* ./icons/$APP 2>/dev/null
- mv ./squashfs-root/usr/share/icons/hicolor/64x64/apps/*$app* ./icons/$APP 2>/dev/null
- mv ./squashfs-root/usr/share/icons/hicolor/128x128/apps/*$app* ./icons/$APP 2>/dev/null
- mv ./squashfs-root/usr/share/icons/hicolor/256x256/apps/*$app* ./icons/$APP 2>/dev/null
- mv ./squashfs-root/usr/share/icons/hicolor/512x512/apps/*$app* ./icons/$APP 2>/dev/null
- mv ./squashfs-root/usr/share/icons/hicolor/scalable/apps/*$app* ./icons/$APP 2>/dev/null
- rm -R -f /opt/$APP/squashfs-root
- mv ./$APP.desktop /usr/share/applications/AM-$APP.desktop
- # CHANGE THE PERMISSIONS
- currentuser=$(who | awk '{print $1}')
- chown -R $currentuser /opt/$APP
- # MESSAGE
- echo "
- $APP is provided by REPLACETHIS
-
- "
|