From 975ea61e059cc2782a02dbfdbc4d396ae0cd363d Mon Sep 17 00:00:00 2001 From: GermanBread <71450236+GermanBread@users.noreply.github.com> Date: Sat, 13 Feb 2021 16:22:36 +0100 Subject: [PATCH 1/2] Check for unzip --- LULI.sh | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/LULI.sh b/LULI.sh index 3271407..471f3f6 100644 --- a/LULI.sh +++ b/LULI.sh @@ -57,6 +57,12 @@ if [[ "$(whoami)" == "root" ]]; then exit fi +# Check if unzip is installed +if [ ! -e /usr/bin/unzip ]; then + Warning "Unzip does not seem to be installed!\n\tThis script depends on this package.\n\tInstall unzip and restart this script.\n\tPress enter if you believe that this is a false-positive." + read +fi + cat << "logo_end" _ _ _ _ _ | | (_)__ _| |_| |_ __ ___ _ _ __| | @@ -138,18 +144,18 @@ case $method in rm -rf Lightcord; rm -rf lightcord-linux-x64.*; SubInfo "Downloading Lightcord" - wget -O lightcord-linux-x64.zip $LC; - if [ $? > '0' ]; then + wget -qO lightcord-linux-x64.zip $LC; + if [ ! $? ]; then SubInfo "Trying alternate URL" - wget -O lightcord-linux-x64.zip $ALT_LC; + wget -qO lightcord-linux-x64.zip $ALT_LC; fi - unzip lightcord-linux-x64.zip -d Lightcord; + unzip -qq lightcord-linux-x64.zip -d Lightcord; cd Lightcord; chmod +x ./lightcord; cd ..; sudo mv Lightcord/ $GLOBAL_INSTALL_DIR; SubInfo "Downloading Lightcord icon" - wget -O lightcord.png $ICON; + wget -qO lightcord.png $ICON; sudo mkdir -p /usr/share/pixmaps; sudo mv lightcord.png /usr/share/pixmaps; SubInfo "Creating Desktop entry" @@ -183,12 +189,12 @@ case $method in SubInfo "Deleting Lightcord" sudo rm -r $GLOBAL_INSTALL_DIR/Lightcord; SubInfo "Downloading Lightcord" - wget -O lightcord-linux-x64.zip $LC; - if [ $? > '0' ]; then + wget -qO lightcord-linux-x64.zip $LC; + if [ ! $? ]; then SubInfo "Trying alternate URL" - wget -O lightcord-linux-x64.zip $ALT_LC; + wget -qO lightcord-linux-x64.zip $ALT_LC; fi - unzip lightcord-linux-x64.zip -d Lightcord; + unzip -qq lightcord-linux-x64.zip -d Lightcord; cd Lightcord; chmod +x ./lightcord; cd ..; @@ -241,13 +247,13 @@ case $method in 1) # Install LC Info 'Installing Lightcord' SubInfo "Downloading Lightcord" - wget -O lightcord.AppImage $LC_APPIMAGE; + wget -qO lightcord.AppImage $LC_APPIMAGE; if [ $? > '0' ]; then SubInfo "Trying alternate URL" - wget -O lightcord.AppImage $ALT_LC_APPIMAGE; + wget -qO lightcord.AppImage $ALT_LC_APPIMAGE; fi SubInfo "Downloading Lightcord icon" - wget -O lightcord.png $ICON; + wget -qO lightcord.png $ICON; mkdir -p $LOCAL_INSTALL_DIR; mv lightcord.AppImage $LOCAL_INSTALL_DIR; chmod +x $LOCAL_INSTALL_DIR/lightcord.AppImage ; @@ -274,10 +280,10 @@ case $method in SubInfo "Deleting Lightcord" rm $LOCAL_INSTALL_DIR/lightcord.AppImage; SubInfo "Downloading Lightcord" - wget -O lightcord.AppImage $LC_APPIMAGE; + wget -qO lightcord.AppImage $LC_APPIMAGE; if [ $? > '0' ]; then SubInfo "Trying alternate URL" - wget -O lightcord.AppImage $ALT_LC_APPIMAGE; + wget -qO lightcord.AppImage $ALT_LC_APPIMAGE; fi mkdir -p $LOCAL_INSTALL_DIR; mv lightcord.AppImage $LOCAL_INSTALL_DIR; From 7bb78596265750a53c6baf387ad3ad354db12009 Mon Sep 17 00:00:00 2001 From: GermanBread <71450236+GermanBread@users.noreply.github.com> Date: Sat, 13 Feb 2021 16:26:51 +0100 Subject: [PATCH 2/2] It wouldn't be a good merge if I forgot some unnecessary stuff I also made wget and unzip quiet --- LULI.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/LULI.sh b/LULI.sh index 471f3f6..b440edc 100644 --- a/LULI.sh +++ b/LULI.sh @@ -166,7 +166,6 @@ case $method in rm -rf Lightcord.*; rm -rf Lightcord; rm -rf lightcord-linux-x64.*; - rm 0 ;; 2) # Uninstall LC @@ -203,7 +202,6 @@ case $method in rm -rf Lightcord.*; rm -rf Lightcord; rm -rf lightcord-linux-x64.*; - rm 0 ;; *) # Do nothing @@ -248,7 +246,7 @@ case $method in Info 'Installing Lightcord' SubInfo "Downloading Lightcord" wget -qO lightcord.AppImage $LC_APPIMAGE; - if [ $? > '0' ]; then + if [ ! $? ]; then SubInfo "Trying alternate URL" wget -qO lightcord.AppImage $ALT_LC_APPIMAGE; fi @@ -262,7 +260,6 @@ case $method in SubInfo "Creating local desktop entry" echo -e "[Desktop Entry]\nName=Lightcord\nComment[fr_FR]=Un client Discord simple et personalisable\nComment=A simple - customizable - Discord Client\nExec=$LOCAL_INSTALL_DIR/lightcord.AppImage\nIcon=lightcord\nTerminal=false\nType=Application\nCategories=Network;InstantMessaging;P2P;" >> ~/.local/share/applications/lightcord.desktop; SubInfo "Cleaning up" - rm 0 ;; 2) # Uninstall LC @@ -281,7 +278,7 @@ case $method in rm $LOCAL_INSTALL_DIR/lightcord.AppImage; SubInfo "Downloading Lightcord" wget -qO lightcord.AppImage $LC_APPIMAGE; - if [ $? > '0' ]; then + if [ ! $? ]; then SubInfo "Trying alternate URL" wget -qO lightcord.AppImage $ALT_LC_APPIMAGE; fi @@ -289,7 +286,6 @@ case $method in mv lightcord.AppImage $LOCAL_INSTALL_DIR; chmod +x $LOCAL_INSTALL_DIR/lightcord.AppImage; SubInfo "Cleaning up" - rm 0 ;; *)