Various updates from DEV
authorAndrew DeFaria <Andrew@DeFaria.com>
Fri, 12 Nov 2021 15:50:51 +0000 (07:50 -0800)
committerAndrew DeFaria <Andrew@DeFaria.com>
Fri, 12 Nov 2021 15:50:51 +0000 (07:50 -0800)
New setlogin for impish
Removed DBUS from cleantmp.conf
Speak has a few improvements on backing off
Removed tabs from gitconfig

bin/setlogin
etc/cleantmp.conf
lib/Speak.pm
rc/gitconfig

index ee71ada..133a8d7 100755 (executable)
 #!/bin/bash
-# Simple script to set the login background
 
-if [ "$UID" != 0 ]; then
-  echo "Must be run as root"
-  exit 1
+codename=$(cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2)
+
+if [ "$codename" == "impish" ]
+then
+source="/usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource"
+else
+echo "
+----------------------------------------
+Sorry, Script is only for Ubuntu 21.10
+Exiting...
+----------------------------------------"
+exit 1
 fi
 
-if [ $# != 1 ]; then
-  echo "Usage: $0 <image file>"
-  exit 1
+pkg=$(dpkg -l | grep libglib2.0-dev >/dev/null && echo "yes" || echo "no")
+if [ "$pkg" == "no" ]
+then
+echo "
+-----------------------------------------------------------------------------------------------------
+Sorry, the package 'libglib2.0-dev' is not installed. Install the package and then run this Script.
+For now, Exiting...
+-----------------------------------------------------------------------------------------------------"
+exit 1
 fi
 
-# Not sure why Yaru was picked as the source...
-source="/usr/share/gnome-shell/theme/Yaru/gnome-shell-theme.gresource"
-color="#000000"
+############################################################################################
+case "$1" in ###############################################################################
+############################################################################################
+--set)
+############################################################################################
+
+if [ "$UID" != "0" ]
+then
+echo "This Script must be run with sudo"
+exit 1
+fi
+
+echo "
+-------------------------------------------------------------------------------------------------------
+Please note that after setting login screen background,
+>>>>>>>>> Reboot is highly recomonded to see the changes <<<<<<<<<<<<
 
-imagefile=$1
+Do you want to proceed now? [Yes/no] Type n to exit, or press enter to proceed.
+-------------------------------------------------------------------------------------------------------"
+read answer
 
-if [ ! -e "$imagefile" ]; then
-  echo "$imagefile not found"
-  exit 1
+if [ "$answer" == "n" ] || [ "$answer" == "N" ]
+then
+echo "Exiting..."
+exit 1
 fi
 
-imagefile=$(echo $imagefile | sed 's/ /%20/g')
+echo "
+Please Choose any one number from below.
+-------------
+1. for Image
+2. for Color
+-------------"
+read a
+
+if [ -z $a ]
+then
+echo "Option is not selected.
+Exiting..."
+exit 1
+fi
+
+if [ "$a" == "1" ]
+then
+echo "Enter Image Path for Login Screen
+----------------------------------------------------
+Example1: /usr/share/backgrounds/2.jpg
+Example2: /usr/local/share/backgrounds/spaceship.png
+Example3: /home/impish/Downloads/myBG.jpeg
+----------------------------------------------------"
+read b
+
+elif [ "$a" == "2" ]
+then
+echo "
+Enter Hex Color Code for Login Screen (you may note down colors of your choice from this link https://www.color-hex.com/)
+-------------------------------------------------------------------------------------------------------------------------
+Example1: #00ff00
+Example2: #fca
+Example3: #456789
+Example4: #123
+Example5: #FF00FF
+-------------------------------------------------------------------------------------------------------------------------"
+read c
+fi
+
+if [ -z $b ] && [ -z $c ]
+then
+echo "Input is not Provided.
+Exiting..."
+exit 1
+fi
+
+if [ -z $c ]
+then
+color="#042320"
+else
+color="$c"
+fi
+
+if ! [ -z $c ]
+then
+       if ! [[ $c =~ ^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$ ]]; then
+       echo "
+------------------------------------------------------------------------------------------------------------
+       Sorry it is not a valid Hex color, Please choose the valid HEX color first and then run this script.
+------------------------------------------------------------------------------------------------------------"
+       exit 1
+       fi
+fi
+
+if ! [ -z $b ]
+then
+       if ! [ -e $b ]; then
+       echo "
+---------------------------------------------------------------------------------------------------
+Image path you entered does not exist, script defined background color is going to be used for now.
+Please notedown the correct file path of the Image and then run this script.
+---------------------------------------------------------------------------------------------------"
+       fi
+fi
 
 prefix="/org/gnome/shell/theme"
-dest="/usr/local/share/gnome-shell/theme/focalgdm3"
+dest="/usr/local/share/gnome-shell/theme/impishgdm"
 
-install -D /dev/null $dest/gdm3.css
-install -D /dev/null $dest/focalgdm3.gresource.xml
+install -D /dev/null $dest/gdm.css
+install -D /dev/null $dest/impishgdm.gresource.xml
 install -d $dest/icons/scalable/actions
 
-gresource extract $source $prefix/gdm3.css > $dest/original.css
+gresource extract $source $prefix/gdm.css > $dest/original.css
 gresource extract $source $prefix/checkbox.svg > $dest/checkbox.svg
 gresource extract $source $prefix/checkbox-off.svg > $dest/checkbox-off.svg
 gresource extract $source $prefix/checkbox-focused.svg > $dest/checkbox-focused.svg
@@ -52,16 +155,16 @@ gresource extract $source $prefix/icons/scalable/actions/eye-open-negative-fille
 
 echo '@import url("resource:///org/gnome/shell/theme/original.css");
   #lockDialogGroup {
-  background: '$color' url(file://'$imagefile');
+  background: '$color' url(file://'$b');
   background-repeat: no-repeat;
   background-size: cover;
-  background-position: center; }' > $dest/gdm3.css
+  background-position: center; }' > $dest/gdm.css
 
 echo '<?xml version="1.0" encoding="UTF-8"?>
 <gresources>
   <gresource prefix="/org/gnome/shell/theme">
     <file>original.css</file>
-    <file>gdm3.css</file>
+    <file>gdm.css</file>
     <file>toggle-off.svg</file>
     <file>checkbox-off.svg</file>
     <file>toggle-on.svg</file>
@@ -80,25 +183,52 @@ echo '<?xml version="1.0" encoding="UTF-8"?>
     <file>icons/scalable/actions/pointer-double-click-symbolic.svg</file>
     <file>icons/scalable/actions/eye-open-negative-filled-symbolic.svg</file>
   </gresource>
-</gresources>' > $dest/focalgdm3.gresource.xml
+</gresources>' > $dest/impishgdm.gresource.xml
 
 cd $dest
-
-glib-compile-resources focalgdm3.gresource.xml
-
-mv focalgdm3.gresource ..
-
+glib-compile-resources impishgdm.gresource.xml
+mv impishgdm.gresource ..
 rm -r $dest
-
-update-alternatives --quiet --install /usr/share/gnome-shell/gdm3-theme.gresource gdm3-theme.gresource /usr/local/share/gnome-shell/theme/focalgdm3.gresource 0
-update-alternatives --quiet --set gdm3-theme.gresource /usr/local/share/gnome-shell/theme/focalgdm3.gresource
-
-check=$(update-alternatives --query gdm3-theme.gresource | grep Value | grep /usr/local/share/gnome-shell/theme/focalgdm3.gresource >/dev/null && echo "pass" || echo "fail")
-
-if [ "$check" == "pass" ]; then
-  echo "Success"
-  exit 0
+update-alternatives --quiet --install /usr/share/gnome-shell/gdm-theme.gresource gdm-theme.gresource /usr/local/share/gnome-shell/theme/impishgdm.gresource 0
+update-alternatives --quiet --set gdm-theme.gresource /usr/local/share/gnome-shell/theme/impishgdm.gresource
+
+check=$(update-alternatives --query gdm-theme.gresource | grep Value | grep /usr/local/share/gnome-shell/theme/impishgdm.gresource >/dev/null && echo "pass" || echo "fail")
+if [ "$check" == "pass" ]
+then
+echo "
+                                               ---------
+                                               |Success|
+                                               ---------"
+else
+echo Failure
+exit 1
+fi
+;;
+############################################################################################
+--reset) ###################################################################################
+############################################################################################
+
+if [ -e /usr/local/share/gnome-shell/theme/impishgdm.gresource ]
+then
+rm /usr/local/share/gnome-shell/theme/impishgdm.gresource
+update-alternatives --quiet --set gdm-theme.gresource "$source"
+cd /usr/local/share
+rmdir --ignore-fail-on-non-empty -p gnome-shell/theme
+echo "
+                                               ---------------
+                                               |Reset Success|
+                                               ---------------"
 else
-  echo "Failure"
-  exit 1
+echo "
+-----------------------------------------------------------------------------
+No need, Already Reset. (or unlikely background is not set using this Script.)
+-----------------------------------------------------------------------------"
+exit 1
 fi
+;;
+############################################################################################
+*) #########################################################################################
+############################################################################################
+echo "Use the parameter '--set' or '--reset'; example: './impishgdm --set' or './impishgdm --reset'"
+exit 1
+esac
index 79f3a4a..4b2338f 100644 (file)
@@ -35,6 +35,5 @@ qipc*
 birdtry*
 nsemail*
 vboxdrv-Module*
-dbus-*
 r2-ipc
 Rainlendar2*
index d462490..dd38346 100644 (file)
@@ -124,10 +124,12 @@ Returns:
   # backoff a little and try again.
   my $attempts   = 0;
   my $maxretries = 3;
-  my $backoff    = 2;
 
   my ($status, @output);
 
+  # Log message to log file if $log was passed in.
+  $log->msg($msg) if $log;
+
   while ($attempts++ < $maxretries) {
     ($status, @output) = Execute "/usr/local/bin/gt \"$msg\"";
 
@@ -140,9 +142,9 @@ Returns:
         error $errmsg;
       } # if
 
-      sleep $backoff++;
+      sleep int rand 10;
     } else {
-      return; # We said our piece...
+      return;
     } # if
   } # while
 
index b2f74bd..13ba678 100644 (file)
@@ -11,7 +11,7 @@
   pager = less -RX
   packedGitLimit=128m
   packedGitWindowSize=128m
-       excludesfile = /home/andrew/.gitignore
+  excludesfile = /home/andrew/.gitignore
 
 [color]
   status=auto
 [push]
   default = simple
 [http]
-       sslVerify = false
+  sslVerify = false
 [credential]
-       helper = store --file ~/.git-credentials
+  helper = store --file ~/.git-credentials
 [pull]
-       rebase = false
+  rebase = false
+[merge]
+  tool = meld
+[mergetoo "meld"]
+  cmd = meld "$LOCAL" "$BASE" "$REMOTE" --output "$MERGED"