From a23c530febcfee585e00beecdced0a9780bcc549 Mon Sep 17 00:00:00 2001 From: mollusk Date: Mon, 14 Jan 2019 22:35:41 -0700 Subject: [PATCH] flatjerk.sh: fix file checking Former-commit-id: 5a762fffd15206b689409e2404199d805858208f Former-commit-id: 76d72e8c469ce8282088ff4cc9d95051c52b0b19 --- flatjerk.sh | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/flatjerk.sh b/flatjerk.sh index b1428a5..b37e108 100755 --- a/flatjerk.sh +++ b/flatjerk.sh @@ -1,14 +1,14 @@ #!/bin/bash -flatpakBin=$(which -a flatpak) -checkApt=$(which -a apt) -checkXbps=$(which -a xbps) +flatpakBin=$(/usr/bin/flatpak) +checkApt=$(/usr/bin/apt) +checkXbps=$(/usr/bin/xbps-install) installFlatpak(){ - if [ ! ${flatpakBin} ];then - if [ ${checkXbps} ];then + if [ ! -f ${flatpakBin} ];then + if [ -f ${checkXbps} ];then sudo xbps-install -S flatpak - elif [ ${checkApt} ];then + elif [ -f ${checkApt} ];then printf "\nChecking for PPA\n" if [ ! -f /etc/apt/sources.list.d/alexlarsson-ubuntu-flatpak-xenial.list ];then printf "\nInstalling PPA\n" @@ -28,7 +28,7 @@ installFlatpak(){ addFlatpakRepo(){ - if [ $(which -a flatpak) ];then + if [ -f ${flatpakBin} ];then printf "\nAdding Flathub Repository..\n" flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo else @@ -44,6 +44,21 @@ getPackages(){ flatpak install flathub org.gtk.Gtk3theme.Adapta-Nokto-Eta } -installFlatpak -addFlatpakRepo -getPackages \ No newline at end of file +helpFile(){ + echo -e "\n\nusage: ${0} [all] [init]\n\n" + echo -e "init only run initial flatpak setup\n" + echo -e "\nall Init setup and packages for jitty\n\n" +} +case ${1} in + + init|-i) + installFlatpak + addFlatpakRepo + ;; + + all|-a) + installFlatpak + addFlatpakRepo + getPackages + ;; +esac \ No newline at end of file