aboutsummaryrefslogtreecommitdiff
path: root/browser/linux/flatpak/build_flatpak.sh
diff options
context:
space:
mode:
Diffstat (limited to 'browser/linux/flatpak/build_flatpak.sh')
-rwxr-xr-xbrowser/linux/flatpak/build_flatpak.sh57
1 files changed, 33 insertions, 24 deletions
diff --git a/browser/linux/flatpak/build_flatpak.sh b/browser/linux/flatpak/build_flatpak.sh
index c2f487d..db8168e 100755
--- a/browser/linux/flatpak/build_flatpak.sh
+++ b/browser/linux/flatpak/build_flatpak.sh
@@ -1,44 +1,53 @@
-
+#!/bin/sh
printf "\n\n---------------------------------------- FLATPAK BUILD --------------------------------------------\n";
-# Install flatpak
-# Installs some needed dependencies
-printf "\nInstalling script dependencies\n";
-apt update;
-apt install -y gnupg2;
+# Setup Script Variables
+BINARY_TARBALL=$1;
+FLATPAK_JSON_FILE=$2;
+FLATPAK_REPO=$3;
+FLATPAK_BUNDLE=$4;
+_APT_SOURCE_LIST=/etc/apt/source.list;
+_APT_REPO='deb http://ppa.launchpad.net/alexlarsson/flatpak/ubuntu bionic main'
+_APT_REPO_KEY=FA577F07;
+_APT_PACKAGES_TO_INSTALL="flatpak flatpak-builder";
+_FLATHUB_REPO="flathub https://flathub.org/repo/flathub.flatpakrepo";
+_FLATHUB_PACKAGES_TO_INSTALL="org.gnome.Platform/x86_64/3.32 org.gnome.Sdk/x86_64/3.32";
+_EXTRACTED_BINARY_TARBALL_FOLDER=./librewolf
+_FLATPAK_BUILD_SOURCE_FOLDER=./source;
+_FLATPAK_BUILD_FOLDER=build-dir;
+
-echo 'deb http://ppa.launchpad.net/alexlarsson/flatpak/ubuntu bionic main' >> /etc/apt/source.list;
-apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FA577F07;
+# Install flatpak
+printf "\nInstalling flatpak\n";
+echo $_APT_REPO >> $_APT_SOURCE_LIST;
+apt update && apt install -y gnupg2 && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $_APT_REPO_KEY;
apt update;
-apt install -y flatpak flatpak-builder;
+apt install -y $_APT_PACKAGES_TO_INSTALL;
# Install build dependencies
printf "\nInstalling flatpak build dependencies\n";
-flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo;
-flatpak install -y org.gnome.Platform/x86_64/3.32 org.gnome.Sdk/x86_64/3.32;
+flatpak remote-add --if-not-exists $_FLATHUB_REPO;
+flatpak install -y $_FLATHUB_PACKAGES_TO_INSTALL;
+
+# Extracts the binary tarball
+printf "\nExtracting librewolf binary tarball\n";
+tar -xvf $BINARY_TARBALL;
# Prepare for flatpak build
printf "\nPreparing files for flatpak build\n";
-mkdir "source";
-cp -r ./librewolf ./source/librewolf;
-cp $SCRIPT_FOLDER/resources/flatpak/io.gitlab.LibreWolf.json ./io.gitlab.LibreWolf.json;
+mkdir $_FLATPAK_BUILD_SOURCE_FOLDER && mv -r $_EXTRACTED_BINARY_TARBALL_FOLDER $_FLATPAK_BUILD_SOURCE_FOLDER/librewolf;
# Build Repo and standalone bundle
printf "\nBuilding flatpak repository and bundle\n";
-flatpak-builder --repo=librewolf-flatpak-repo build-dir io.gitlab.LibreWolf.json;
-flatpak build-bundle librewolf-flatpak-repo LibreWolf.flatpak io.gitlab.LibreWolf master;
-
-# move repo and bundle to build output here
-printf "\nMoving repository and bundle to build output folder\n";
-mv libreWolf-flatpak-repo build_output;
-mv LibreWolf.flatpak build_output;
+flatpak-builder --repo=$FLATPAK_REPO $_FLATPAK_BUILD_FOLDER $FLATPAK_JSON_FILE;
+flatpak build-bundle $FLATPAK_REPO $FLATPAK_BUNDLE io.gitlab.LibreWolf master;
# Clean up flatpak files
printf "\nCleaning up flatpak related files\n";
-rm -rf ./build-dir;
-rm -rf ./source;
+rm -rf $_FLATPAK_BUILD_FOLDER;
+rm -rf $_FLATPAK_BUILD_SOURCE_FOLDER;
rm -rf ./.flatpak-builder;
# Delete the extracted binary tarball folder
printf "\nDeleting extracted binary tarball folder\n";
-rm -rf ./librewolf;
+rm -rf $_EXTRACTED_BINARY_TARBALL_FOLDER;
bgstack15