Browse Source

Initial Commit v0.1

mike 1 month ago
commit
48a7a51d8a
4 changed files with 128 additions and 0 deletions
  1. 2 0
      .gitignore
  2. 17 0
      assets/keepassxc.desktop
  3. BIN
      assets/keepassxc.png
  4. 109 0
      install.sh

+ 2 - 0
.gitignore

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

+ 17 - 0
assets/keepassxc.desktop

@@ -0,0 +1,17 @@
+[Desktop Entry]
+Version=1.0
+#NoDisplay=true
+Name=KeePass Password Manager
+GenericName=Pasword Manager
+#Keywords=Internet;WWW;Browser;Web;Explorer
+Exec=keepass &
+Terminal=false
+#X-MultipleArgs=false
+Type=Application
+Icon=/home/mike/Software/KeePassXC/assets/keepassxc.png
+#Categories=GNOME;GTK;Network;WebBrowser;
+MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;video/webm;application/x-xpinstall;
+#StartupNotify=true
+#StartupWMClass=firefox
+#Actions=new-window;new-private-window;
+

BIN
assets/keepassxc.png


+ 109 - 0
install.sh

@@ -0,0 +1,109 @@
+#! /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##
+
+projectdir="/home/mike/Software/KeePassXC"
+imagepath="$projectdir/apps"
+executablelink="/usr/local/bin"
+desktoppath="/usr/local/share/applications"
+assetspath="$projectdir/assets"
+version="0.1"
+
+# Start Script #
+
+echo "KeePassXC Update Script v$version"
+
+
+# Check Arguments #
+
+if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
+  helpFunction
+  exit 0
+fi
+
+# 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
+  exit 1
+fi
+
+# Check if user-provided file is valid #
+if [ -z "$1" ]; then
+  echo " "
+  echo "No filename given.  Aborting."
+  helpFunction
+  exit 1
+fi
+
+# Check if the string is a valid file #
+if ! [ -f "$1" ]; then
+  echo "$1 not found."
+  helpFunction
+  exit 1
+else
+  # Set filename now that we have a good file #
+  filename=$(basename $1)  ##Take Basename in case file in cae user is in unusual directory when calling script.
+fi
+
+# Move file if necessare #
+if ! [ -f "$imagepath/$filename" ]; then
+  echo "Moving $1 to $imagepath/"
+  mv $1 $imagepath/
+  echo "Done."
+fi
+
+# Argument and file checking complete...#
+
+echo "Updating KeePassXC 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/keepass
+echo "Done."
+
+
+# Ensure Desktop file is set
+
+if ! [ -f "$assetspath/keepassxc.desktop" ]; then
+  echo "WARNING: keepassxc.desktop file not found!"
+  echo "WARNING: Desktop file not set!"
+  exit 1
+fi
+
+echo "Setting keepassxc.desktop in /usr/local/share/applications and verifying permissions"
+ln -fs $assetspath/keepassxc.desktop $desktoppath/
+chmod +x $assetspath/keepassxc.desktop
+echo "Done."
+
+echo "Update Complete.  Done."
+exit 0