navpoint/build-linux.sh

57 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
arch=$(uname -m)
distName=navpoint-linux-$arch
rm -rf dist/$distName-bundle
mkdir -p dist/$distName-bundle
pyinstaller --windowed --onefile \
--hidden-import tornado.web \
--add-data README.md:files \
--add-data GPL-3.0.txt:files \
--add-data CC-BY-SA-4.0.txt:files \
main.py
cp dist/main dist/$distName-standalone
mv dist/main dist/$distName-bundle/navpoint
cp icon.png dist/$distName-bundle/navpoint.png
cp GPL-3.0.txt CC-BY-SA-4.0.txt dist/$distName-bundle/
pandoc -s --metadata "title=Navpoint Desktop" README.md |
grep -v 'h1 id="navpoint-desktop"' \
> dist/$distName-bundle/README.html
cat > dist/$distName-bundle/navpoint.desktop << HERE
[Desktop Entry]
Type=Application
Terminal=false
Name=Navpoint
Exec=/bin/sh -c "$HOME/.local/bin/navpoint"
Icon=navpoint
Categories=Application;Network
StartupWMClass=navpoint
HERE
cat > dist/$distName-bundle/install.sh << HERE
#!/bin/sh
binary_target=~/.local/bin/
desktop_target=~/.local/share/applications/
icon_target=~/.local/share/icons/
mkdir -p \$binary_target \$desktop_target \$icon_target
cp navpoint \$binary_target/navpoint
chmod +x \$binary_target/navpoint
cp navpoint.desktop \$desktop_target/navpoint.desktop
cp navpoint.png \$icon_target/navpoint.png
HERE
chmod +x dist/$distName-bundle/install.sh
cd dist
tar -czf $distName-bundle.tar.gz $distName-bundle