me.fier.gawk/install.sh

43 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
cd "$(dirname "$(realpath "$BASH_SOURCE")")"
DIST="me.fier.gawk"
PRETTY_DIST="gawk"
INSTALL_PATH="/opt"
EXECUTABLE="gawk.py"
LAUNCHER_PATH="/usr/local/share/applications"
ICON_PATH="/usr/share/icons"
if [ "$1" = "-u" ]; then
INSTALL_PATH="$HOME/.local/opt"
LAUNCHER_PATH="$HOME/.local/share/applications"
ICON_PATH="$HOME/.icons"
fi
LAUNCHER_FILE="\
[Desktop Entry]
Name=$PRETTY_DIST
GenericName=Web Browser
Exec=$INSTALL_PATH/$DIST/$EXECUTABLE %u
Terminal=false
Type=Application
Categories=GTK;WebBrowser;Network
Icon=$dist
MimeType=x-scheme-handler/unknown;x-scheme-handler/about;x-scheme-handler/https;x-scheme-handler/http;text/html;image/gif;image/jpeg;image/png;image/webp;video/webm;\
"
if [ -d "$INSTALL_PATH/$DIST" ]; then
rm -rf "$INSTALL_PATH/$DIST"
fi
mkdir -p "$INSTALL_PATH/$DIST"
cp -r . "$INSTALL_PATH/$DIST"
mkdir -p "$ICON_PATH"
cp "$INSTALL_PATH/$DIST/user/addon/favicon/default.png" "$ICON_PATH/$DIST.png"
mkdir -p "$LAUNCHER_PATH"
echo "$LAUNCHER_FILE" > "$LAUNCHER_PATH/$DIST.desktop"
chmod +x "$LAUNCHER_PATH/$DIST.desktop"