From 7d70f164ffe56e5fc89e8c15adc0ddd18bb51c8d Mon Sep 17 00:00:00 2001 From: Fierelier Date: Sat, 1 Apr 2023 20:18:08 +0200 Subject: [PATCH] Add install script --- install.sh | 41 +++++++++++++++++++++++++++++++++++++++++ readme.txt | 4 +++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100755 install.sh diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..a2e892e --- /dev/null +++ b/install.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +set -e + +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" diff --git a/readme.txt b/readme.txt index 3edb24a..d11f080 100644 --- a/readme.txt +++ b/readme.txt @@ -1,4 +1,6 @@ Gawk is a minimal browser. It opens the page you give as the first argument and gives you a default WebKit browser. Any further functionality has to be added/replaced with addons. Prerequisites: -sudo apt install python3-munch python3-gi python3-gi-cairo gir1.2-gtk-3.0 gir1.2-webkit2-4.0 \ No newline at end of file +sudo apt install python3-munch python3-gi python3-gi-cairo gir1.2-gtk-3.0 gir1.2-webkit2-4.0 + +You can either run gawk.py directly from where it is, or you can install the browser with `sudo ./install.sh`. For a user-wide install, do `./install.sh -u`.