/
libreoffice-still-full
75 lines (61 loc) · 2.28 KB
/
libreoffice-still-full
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/sh
APP=libreoffice
# 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* /opt/$APP /usr/local/bin/$APP" >> /opt/$APP/remove
chmod a+x /opt/$APP/remove
# DOWNLOAD THE APPIMAGE
rm -R -f /opt/$APP/version
wget https://appimages.libreitalia.org/LibreOffice-still.full-x86_64.AppImage -O $APP
wget https://appimages.libreitalia.org/LibreOffice-still.full-x86_64.AppImage.zsync -O $APP.zsync 2> /dev/null
echo "https://appimages.libreitalia.org/LibreOffice-still.full-x86_64.AppImage" >> version
chmod a+x /opt/$APP/$APP
# LINK
ln -s /opt/$APP/$APP /usr/local/bin/$APP
# SCRIPT TO UPDATE THE PROGRAM
cat >> /opt/$APP/AM-updater << 'EOF'
#!/bin/sh
APP=libreoffice
cd /opt/$APP
mkdir tmp
cd ./tmp
wget $(cat /opt/$APP/version).zsync;
cd ..
mv ./tmp/*mage.zsync ./$APP.zsync
rmdir ./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
# ICONS
cd /opt/$APP
mkdir icons
mv $(./libreoffice --appimage-extract usr/share/icons/hicolor/scalable/apps/*.svg) ./icons/ 2> /dev/null
RELEASE=$(ls ./icons | head -1 | rev | cut -c 10- | rev)
mv ./icons/$RELEASE-base* ./icons/$APP-base 2> /dev/null
mv ./icons/$RELEASE-basic* ./icons/$APP-basic 2> /dev/null
mv ./icons/$RELEASE-calc* ./icons/$APP-calc 2> /dev/null
mv ./icons/$RELEASE-chart* ./icons/$APP-chart 2> /dev/null
mv ./icons/$RELEASE-draw* ./icons/$APP-draw 2> /dev/null
mv ./icons/$RELEASE-extension* ./icons/$APP-extension 2> /dev/null
mv ./icons/$RELEASE-impress* ./icons/$APP-impress 2> /dev/null
mv ./icons/$RELEASE-main* ./icons/$APP-main 2> /dev/null
mv ./icons/$RELEASE-math* ./icons/$APP-math 2> /dev/null
mv ./icons/$RELEASE-startcenter* ./icons/$APP-startcenter 2> /dev/null
mv ./icons/$RELEASE-writer* ./icons/$APP-writer 2> /dev/null
# LAUNCHERS
mv $(./libreoffice --appimage-extract opt/libreoffice*/share/xdg) . 2> /dev/null
cd xdg
for f in * ; do mv $f AM-$APP-$f; done
sed -i "s# $(echo $RELEASE | cut -c 12-) # #g" *
sed -i "s#Icon=$APP#Icon=/opt/$APP/icons/$APP#g" *
sed -i "s#$RELEASE#$APP#g" *
sed -i '/Name=LibreOffice/c\Name=LibreOffice' ./*startcenter.desktop
cd ..
mv ./xdg/* /usr/share/applications/ 2> /dev/null
rm -R -f /opt/$APP/squashfs-root
rm -R -f /opt/$APP/xdg