浏览代码

Initial commit after rewrite to standard format.

mike 1 月之前
父节点
当前提交
eeab04a91d
共有 8 个文件被更改,包括 108 次插入145 次删除
  1. 2 0
      .gitignore
  2. 二进制
      assets/default128.png
  3. 二进制
      assets/firefox-144.0.2.tar.xz
  4. 二进制
      assets/firefox-144.0.tar.xz
  5. 0 0
      assets/firefox.desktop
  6. 72 36
      install.sh
  7. 0 107
      install.sh.NEXTCLOUD
  8. 34 2
      install.sh.OLD

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+apps/
+*.swp

二进制
assets/default128.png


二进制
assets/firefox-144.0.2.tar.xz


二进制
assets/firefox-144.0.tar.xz


+ 0 - 0
firefox.desktop → assets/firefox.desktop


+ 72 - 36
install.sh

@@ -12,12 +12,11 @@
 helpFunction()
 helpFunction()
 {
 {
   echo " "
   echo " "
-  echo "Provides convenient means to install a new Firefox tar file."
-  echo "Pass new tar file as argument and this script will handle backing up the current installation and unpacking the new installation."
-  echo "This script will prompt before deleting a previous archive."
+  echo "Provides convenient means to install a new firefox file."
+  echo "Pass new TAR or TAR.BZ file as argument and this script will unpack and update the symlinks and verify installation."
   echo "Must run with root privileges."
   echo "Must run with root privileges."
   echo " "
   echo " "
-  echo "Usage: $0 [filename]"
+  echo "Usage: sudo $0 [filename]"
   echo " "
   echo " "
 }
 }
 
 
@@ -26,37 +25,63 @@ helpFunction()
 
 
 ## Take input and verify file and root user##
 ## Take input and verify file and root user##
 
 
-filename=$1
 
 
-if [ "$filename" = "-h" ] || [ "$filename" = "--help" ]; then
+projectname="Firefox Browser Update Script"
+projectdir="/home/mike/Software/firefox"
+imagepath="$projectdir/apps"
+executablelink="/usr/local/bin"
+desktoppath="/usr/local/share/applications"
+assetspath="$projectdir/assets"
+version="0.1"
+
+
+echo "$projectname v$version"
+
+
+# Check Arguments #
+
+if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
   helpFunction
   helpFunction
   exit 0
   exit 0
 fi
 fi
 
 
-if ! [ -f "$filename" ]; then
-  echo "$1 not found."
+# Check if user is root #
+if [ "$USER" != "root" ]; then
+  echo "Must be running as root to install new software.  Use sudo or root user"
   helpFunction
   helpFunction
   exit 1
   exit 1
 fi
 fi
 
 
-if [ -z "$filename" ]
-then
-  echo " "
-  echo "No filename given.  Aborting."
-  helpFunction
-  exit 1
+# Check if any string was provided as in input #
+if [ -z "$1" ]; then
+  echo " " 
+  echo "No filename given.  Aborting." 
+  helpFunction 
+  exit 1 
 fi
 fi
 
 
-if [ "$USER" != "root" ]; then
-  echo "Must be running as root to install new software.  Use sudo or root user"
+# Check if the string is a valid file #
+if ! [ -f "$1" ]; then
+  echo "$1 not found."
   helpFunction
   helpFunction
   exit 1
   exit 1
+else
+  # Set filename now that we have a good file #
+  filename=$(basename $1)  ##Take Basename in case file in case user is in unusual directory when calling script.
+fi 
+
+# Move file if necessary #
+if ! [ -f "$imagepath/$filename" ]; then
+  echo "Moving $1 to $imagepath/"
+  mv $1 $imagepath/
+  echo "Done."
 fi
 fi
 
 
-echo "$1 file found"
+# Argument and file checking complete...#
 
 
+# Start Script #
 
 
-## Move existing folder to .OLD and delete existing .OLD if needed ##
+echo "Updating $projectname ..."
 
 
 echo "Checking for old installations"
 echo "Checking for old installations"
 
 
@@ -81,37 +106,48 @@ echo "unpacking "$filename" to /opt/firefox"
 ## Check file type and unpack accordingly ##
 ## Check file type and unpack accordingly ##
 
 
 if [[ "$filename" == *.tar.xz ]]; then
 if [[ "$filename" == *.tar.xz ]]; then
-  echo "Unpacking as tar.xf file" 
-  tar -xvf "$filename" -C "/opt/"
+  echo "Unpacking as tar.xz file" 
+  tar -xvf "$imagepath/$filename" -C "/opt/"
 elif [[ "$filename" == *.tar.bz2 ]]; then
 elif [[ "$filename" == *.tar.bz2 ]]; then
   echo "Unpacking as tar.bz2 file"
   echo "Unpacking as tar.bz2 file"
-  tar -xjvf "$filename" -C "/opt/"
+  tar -xjvf "$imagepath/$filename" -C "/opt/"
 else
 else
   echo "WARNING: Unknown Compression Type.  Aborting."
   echo "WARNING: Unknown Compression Type.  Aborting."
   exit 1
   exit 1
 fi
 fi
 
 
+#
 
 
-# ensure symlink is set
+#
+#
+## Ensure AppImage is Executable
+#
+#echo "Setting $filename as executable"
+#sudo chmod +x $imagepath/$filename
+#echo "Done."
+#
+#
 
 
-ln -fs /opt/firefox/firefox /usr/local/bin/firefox
-echo "Symlink /usr/local/bin/firefox set."
+# Ensure symlink is set
 
 
-# ensure /opt permissions are set correctly
+echo "Setting symlink /usr/local/bin/firefox"
+ln -fs /opt/firefox/firefox $executablelink/firefox
+chowm mike:mike /opt/firefox # Write permissions needed for firefox to check for updates
+echo "Done."
 
 
-chown mike:mike /opt/firefox
-echo "/opt/firefox permissions set"
 
 
-# ensure .desktop file is set
+# Ensure Desktop file is set
 
 
-if [ -f "firefox.desktop" ]; then
-  echo "Setting .desktop file."
-  ln -fs /home/mike/Software/firefox/firefox.desktop /usr/local/share/applications
-  echo "Done."
-else
-  echo ""
-  echo "WARNING: firefox.desktop not found.  Could not install desktop file."
-  echo "Check for existence of firefox.desktop file in this folder."
+if ! [ -f "$assetspath/firefox.desktop" ]; then
+  echo "WARNING: firefox.desktop file not found!"
+  echo "WARNING: Desktop file not set!"
   exit 1
   exit 1
 fi
 fi
 
 
+echo "Setting firefox.desktop in /usr/local/share/applications and verifying permissions"
+ln -fs $assetspath/firefox.desktop $desktoppath/
+chmod +x $assetspath/firefox.desktop
+echo "Done."
+
+echo "Update Complete.  Done."
+exit 0

+ 0 - 107
install.sh.NEXTCLOUD

@@ -1,107 +0,0 @@
-#! /bin/bash
-
-# - Take new tar file as argument		DONE
-# - Verify argument is valid			DONE
-# - Verify script is running as sudo		DONE
-# - Move existing firefox to firefox.OLD	DONE
-# - create directory for new installation	DONE
-# - unpack tar file to new location		DONE
-# - Optional, verify desktop file extsts
-
-
-helpFunction()
-{
-  echo " "
-  echo "Provides convenient means to install a new Nextcloud AppImage file."
-  echo "Pass new AppImage file as argument and this script will update the symlinks and verify installation."
-  echo "Must run with root privileges."
-  echo " "
-  echo "Usage: sudo $0 [filename]"
-  echo " "
-}
-
-
-
-
-## Take input and verify file and root user##
-
-filename=$(basename $1)  ##Take Basename in case file in cae user is in unusual directory when calling script.
-projectdir="/home/mike/Software/Nextcloud"
-imagepath="$projectdir/apps"
-executablelink="/usr/local/bin"
-desktoppath="/usr/local/share/applications"
-assetspath="$projectdir/assets"
-version="0.2"
-
-# Start Script #
-
-echo "Nextcloud Client Update Script v$version"
-
-
-# Check Arguments #
-
-if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
-  helpFunction
-  exit 0
-fi
-
-  # Check if user-provided file is valid #
-
-if ! [ -f "$1" ]; then
-  echo "$1 not found."
-  helpFunction
-  exit 1
-elif ! [ -f "$imagepath/$filename" ]; then
-  echo "Moving $1 to $imagepath/"
-  mv $1 $imagepath/
-  echo "Done."
-fi
-
-if [ -z "$filename" ]
-then
-  echo " "
-  echo "No filename given.  Aborting."
-  helpFunction
-  exit 1
-fi
-
-if [ "$USER" != "root" ]; then
-  echo "Must be running as root to install new software.  Use sudo or root user"
-  helpFunction
-  exit 1
-fi
-
-# Argument and file checking complete...#
-
-echo "Updating Nextcloud client..."
-
-
-# Ensure AppImage is Executable
-
-echo "Setting $filename as executable"
-sudo chmod +x $imagepath/$filename
-echo "Done."
-
-
-# Ensure symlink is set
-
-echo "Setting symlink /usr/local/bin/nextcloud/"
-ln -fs $imagepath/$filename $executablelink/nextcloud
-echo "Done."
-
-
-# Ensure Desktop file is set
-
-if ! [ -f "$assetspath/nextcloud.desktop" ]; then
-  echo "WARNING: nextcloud.desktop file not found!"
-  echo "WARNING: Desktop file not set!"
-  exit 1
-fi
-
-echo "Setting nextcloud.desktop in /usr/local/share/applications and verifying permissions"
-ln -fs $assetspath/nextcloud.desktop $desktoppath/
-chmod +x $assetspath/nextcloud.desktop
-echo "Done."
-
-echo "Update Complete.  Done."
-exit 0

+ 34 - 2
install.sh.OLD

@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
 
 
 # - Take new tar file as argument		DONE
 # - Take new tar file as argument		DONE
 # - Verify argument is valid			DONE
 # - Verify argument is valid			DONE
@@ -78,8 +78,40 @@ mkdir /opt/firefox
 
 
 echo "unpacking "$filename" to /opt/firefox"
 echo "unpacking "$filename" to /opt/firefox"
 
 
-tar -xjvf "$filename" -C "/opt/"
+## Check file type and unpack accordingly ##
+
+if [[ "$filename" == *.tar.xz ]]; then
+  echo "Unpacking as tar.xf file" 
+  tar -xvf "$filename" -C "/opt/"
+elif [[ "$filename" == *.tar.bz2 ]]; then
+  echo "Unpacking as tar.bz2 file"
+  tar -xjvf "$filename" -C "/opt/"
+else
+  echo "WARNING: Unknown Compression Type.  Aborting."
+  exit 1
+fi
+
 
 
 # ensure symlink is set
 # ensure symlink is set
 
 
 ln -fs /opt/firefox/firefox /usr/local/bin/firefox
 ln -fs /opt/firefox/firefox /usr/local/bin/firefox
+echo "Symlink /usr/local/bin/firefox set."
+
+# ensure /opt permissions are set correctly
+
+chown mike:mike /opt/firefox
+echo "/opt/firefox permissions set"
+
+# ensure .desktop file is set
+
+if [ -f "firefox.desktop" ]; then
+  echo "Setting .desktop file."
+  ln -fs /home/mike/Software/firefox/firefox.desktop /usr/local/share/applications
+  echo "Done."
+else
+  echo ""
+  echo "WARNING: firefox.desktop not found.  Could not install desktop file."
+  echo "Check for existence of firefox.desktop file in this folder."
+  exit 1
+fi
+