/
appimage.sh
39 lines (36 loc) · 1.04 KB
/
appimage.sh
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
#!/usr/bin/env bash
# build app
flutter build linux --release
# create directory for appimage generation if not exists
mkdir -p appimage/musicpod.AppDir/opt/musicpod
# copy app contents to it
cp -r build/linux/x64/release/bundle/ appimage/musicpod.AppDir/opt/musicpod
# copy icon
cp snap/gui/musicpod.png appimage/musicpod.AppDir/music-app.png
# create runner
cat > appimage/musicpod.AppDir/AppRun <<EOF
#!/bin/sh
function readlink_file()
{
next_path=\$1
while [ "\$i" != 10 ] && [ "x\$next_path" != "x\$path" ]; do
path=\$next_path
next_path=\$(readlink "\$path" || echo \$path)
i=\`expr \$i + 1\`
done
echo "\$path"
}
function basedir()
{
file=\$(readlink -f "\$1") || \$(readlink_file "\$1")
echo \$(cd "\$(dirname "\$file")" && pwd -P)
}
cd \$(basedir "\$0") && opt/musicpod/bundle/musicpod
EOF
# make it executable
chmod +x appimage/musicpod.AppDir/AppRun
# copy .desktop file
cp snap/gui/musicpod.desktop appimage/musicpod.AppDir/
# make appimage
cd appimage && ~/Applications/appimagetool musicpod.AppDir
cd ..