"install and setup pc.sh" bashscript

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
User avatar
majpooper
Level 8
Level 8
Posts: 2084
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: "install and setup pc.sh" bashscript

Post by majpooper »

motoryzen wrote: Mon May 15, 2023 5:35 pm 1. Themes - Mouse Pointer, Applications, Icons, Desktop gui setting adjustments
2. Screensaver to disable it completely as well as disable locking the PC and disable display sleeping
3. Display - (setting the hz refresh rate)
4. gnome-terminal - auto setting a custom background color and regular font color, font style, and highlighted font color as well as keybindings/keyboard shortcuts away from stock.
5. Windows- setting the custom "Draggable border width" to 22 ish " which is wider than stock, " Location of newly opened Windows" to ' Center ', and Alt-Tab button/tab selection= 'Delay before display the alt-tab switcher.

Any progress on your install script ?
I think a lot of what you want to do can be accomplished with loading a dconf dump to the target system.
I don't know about 3. and 5. as I don't ever change them so I would have to see where they are controled.
1. for sure from dconf - not sure what you mean though by " gui setting adjustments"
2. for sure from dconf
4. for sure from dconf - except the key bindings/keyboard short cuts I am not sure about as I never do anything with them so would have to figure out where they are stored - maybe dconf, but I just don't know

Don't be fooled - I really am a hack and only know enough about scripting to be dangerous - just ask rene he has bailed me out more than a few times along with a few others. Anyway a simple script to load a dconf dump is petty easy.
motoryzen
Level 10
Level 10
Posts: 3474
Joined: Sun Dec 08, 2019 12:25 am

Re: "install and setup pc.sh" bashscript

Post by motoryzen »

Any progress on your install script ?
A decent bit actually.

I'm 90 percent done with it. I'll try to make time this evening to post the uodated bashcript
Mint 21.2 Cinnamon 5.8.4
asrock x570 taichi ...bios p5.00
ryzen 5900x
128GB Kingston Fury @ 3600mhz
Corsair mp600 pro xt NVME ssd 4TB
three 4TB ssds
dual 1TB ssds
Two 16TB Toshiba hdd's
24GB amd 7900xtx vid card
Viewsonic Elite UHD 32" 144hz monitor
motoryzen
Level 10
Level 10
Posts: 3474
Joined: Sun Dec 08, 2019 12:25 am

Re: "install and setup pc.sh" bashscript

Post by motoryzen »

So here's the updated progress on my script ( again..remember..I'm testing it on the secondary PC that has some different hardware , no dedicated gpu..)

So far all of this..just works and I think maybe at one measly point did I have to intervene via having to manually type my password for one of the tasks..that I forgot to log which one and edit .

More to come later

Code: Select all

#!/bin/bash

#1   😶️don't nuke LIBDRM-NOUVEAU2 package🤔️. <<< THIS..IS ESSENTIAL for some games that rely on wine/lutris such as the Prince of Persia games, Medal of Honor L.E. and probably more ..confirmed 3-22-23 evening time!!

# Copy the fstab backup file back to /etc folder if needs be

#2.  manually via gnome-disks mount all other drives you plan to keep connected at all times...FIRST..before doing anything.
# 16TB toshiba ( hdd )
# goPro 1TB Backup  ( 1 tb samsung ssd
# sdb1 rsyncbackup  ( it's a 4TB samsung ssd
echo " .. ... .. piss of mintwelcome. I'll decide alittle later... '"

pkill mintwelcome &&  sleep 1 && echo  " .. now let's install some stuff  .."

# Now to install some stuff
sudo apt install xdotool -yy aptitude gedit ratbagd piper youtubedl-gui brasero audacious audacity mediainfo-gui vlc obs-studio imwheel libvulkan1 libvulkan-dev hardinfo gimp gparted ffmpeg numlockx git dconf-editor autocutsel screenruler git dialog

#  "placement-mode" deals with newly launch windows where they end up on screen
gsettings set org.cinnamon.muffin placement-mode 'center' &&

sleep 1 && echo "  ..  . . Now set color schemes ... ."

xdotool keydown ctrl+alt sleep 0.25 key t sleep 0.25 keyup ctrl+alt && xdotool type "mintwelcome" && xdotool sleep 0.25 key Return &&
xdotool sleep 1.25 key Down sleep 0.5 key Return && xdotool sleep 0.25 mousemove 1625 560 sleep 0.25 click 1 &&
# above command moves to and selects the Teal desktop color theme

xdotool sleep 1 mousemove 1385 600 sleep 0.25 click 1 &&
# above command moves and selects the Dark Mode

xdotool sleep 2 mousemove 1500 950 sleep 0.25 click 1
# above command unchecks " show this dialog at startup "

xdotool sleep 1 key alt+space sleep 0.25 key shift+Tab sleep 0.33 key Return &&

sleep 1 && echo "  ... ..  let's fix xed so we can see wth we're following... ... "
# let's change that ugly tango theme in xed to cobalt, make it show lines, turn off auto save, and make it print line numbers when printing a page

gsettings set org.x.editor.preferences.editor display-line-numbers 'true' &&
gsettings set org.x.editor.preferences.print print-line-numbers '1000' &&
gsettings set org.x.editor.preferences.editor scheme 'cobalt' &&
gsettings set org.x.editor.preferences.editor auto-save 'false' &&
gsettings set org.x.editor.preferences.editor editor-font 'Monospace 9'

sleep 1 && echo   "  ..now time for Themes and Desktop window management tweaks ....   "
#                  <<><><><>< Themes and Desktop window management and keyboard stuff<><><<<><><
#  turn on numlock state and make it remember it
gsettings set org.cinnamon.desktop.peripherals.keyboard remember-numlock-state true &&
gsettings set org.cinnamon.desktop.peripherals.keyboard numlock-state true &&
gsettings set org.cinnamon.desktop.peripherals.keyboard repeat-interval '20' &&
gsettings set org.cinnamon.desktop.interface enable-animations false &&

gsettings set org.cinnamon startup-animation false &&

sleep 1 && pkill mintreport-tray &&

sleep 1 && pkill mintUpdate &&

sleep 1 && echo   " .....  all of these commands make the changes immediately   ...."

#  command of "cinnamon.theme name " deals with changing Desktop theme  (Themes application then Desktop selection)
gsettings set org.cinnamon.theme name 'Mint-Y-Dark-Teal'

# command of "desktop.interface gtk-theme" deals with changing Applications theme ( Themes app, then Applications selection)
gsettings set org.cinnamon.desktop.interface gtk-theme 'Mint-Y-Dark-Teal'

# command of "icon-theme" changes  Themes / Icons selection
gsettings set org.cinnamon.desktop.interface icon-theme 'Adwaita' &&

sleep 1 && echo " .. .. ..  let's end that screen saver and screen locking nonsense.. ..  "

#screw screen locking and make the power button immediately power down the PC
# Prevent screensaver.. screen sleeping and locking system.. and make the power button immediately power down the PC
gsettings set org.gnome.desktop.screensaver ubuntu-lock-on-suspend false

# ensure the FileChooser ( applicable when changing icons of items) will show hidden file directories such as /usr/share/icons 😉
gsettings set org.gtk.Settings.FileChooser show-hidden true

#  speed up the mouse hover show item on panel speed
gsettings set com.linuxmint.mintmenu.plugins.applications category-hover-delay 25 &&

sleep 1 && echo "  no sense in nemo remaining open and going to /home when an external device disconnects/ejects  "
#  "device-eject" involved command make it to where when an external device like usb drive is removed or ejected..that nemo window immediately closes
gsettings set org.nemo.preferences close-device-view-on-device-eject true

# command below changed " suspend when inactive for  to  " never "
gsettings set org.cinnamon.settings-daemon.plugins.power sleep-inactive-ac-timeout 0

# command below prevents the suspend button from doing anything
gsettings set org.cinnamon.settings-daemon.plugins.power button-suspend 'nothing'

# this " sleep-display-ac " command changing " turn off the screen when inactive for to " never "
gsettings set org.cinnamon.settings-daemon.plugins.power sleep-display-ac 0

# below command changes " when the power button is pressed from " ask " to " shut down immediately"
gsettings set org.cinnamon.settings-daemon.plugins.power button-power shutdown

# "idle-delay " command below changes " Delay before starting the screensaver to Never
gsettings set org.cinnamon.desktop.session idle-delay 0

#  "lock-enabled" command changes " Lock the computer after screensaver starts to disabled state
gsettings set org.cinnamon.desktop.screensaver lock-enabled false

#  "lock-on suspend" command below will change " Lock the computer when put to sleep " to disabled state
gsettings set org.cinnamon.settings-daemon.plugins.power lock-on-suspend false

# terminal.I'll close you when I feel like it..don't need a " are you sure" message"  "
gsettings set org.gnome.Terminal.Legacy.Settings confirm-close false &&

sleep 1 && echo "      .....  desktop effects    ... "


sleep 1 && echo " ... no need for startup animation for the desktop ...this command will disable that ... "

# don't need a startup animation for the desktop
gsettings set org.cinnamon startup-animation false

sleep 1 && echo "  ... ***  screw windows effects...let's disable them all  ... ***   "

#  "desktop-effects-workspace" command below will disable  ALL windows effects and desktop effects
gsettings set org.cinnamon desktop-effects-workspace false

sleep 1 && echo " ==    let's change the cursor from box to underline and speed up the blink speed  ... . "

# "cursor-blink-time" command below changes cursor blinking speed. 2nd command changes cursor sleep timeout in seconds
gsettings set org.cinnamon.desktop.interface cursor-blink-time 500
gsettings set org.cinnamon.desktop.interface cursor-blink-timeout 2000

sleep 1 && echo "  ..  draggable click-drag border is too skinny and alt tab switcher delay is too big ..let's change those . "

# -- more general settings stuff  --
gsettings set org.cinnamon.muffin draggable-border-width 22
gsettings set org.cinnamon alttab-switcher-delay 0

sleep 1 && echo " ... remove military time setting and show seconds in the clock  ..."

# "clock-use-24h' command below changes clock from miltary time to regular 12h time, next one changes to showing the live seconds.
gsettings set org.cinnamon.desktop.interface clock-use-24h false
gsettings set org.cinnamon.desktop.interface clock-show-seconds true

sleep 1 && echo " .  == Let's change the application, destkop and icon themes to mint y dark teal and adwaita  .  == "
#  "gtk-theme "  command below = same as opening Themes, then clicking on The theme button to the right of " Applications "
gsettings set org.cinnamon.desktop.interface gtk-theme Mint-Y-Dark-Teal

sleep 1 && echo "  classic bibata original is sharper than the bubbling stock/default...    "

sleep 1 && echo "... remember when changing anything in the Themes application the changes within that app won't show on the same one if you launched this before launching this setup script......"
# "cursor-theme" command below sets the mouse cursor to the obviously named option
gsettings set org.cinnamon.desktop.interface cursor-theme Bibata-Original-Classic

# "buttons-have-icons"  means opening Themes, settings tab upper right, enable " Show icons on buttons"
gsettings set org.cinnamon.desktop.interface buttons-have-icons true

#  "inherit-folder-viewer" command below ticks the box in Nemo to ensure each folder has same icon view type as parent folders
gsettings set org.nemo.preferences inherit-folder-viewer true

# "show hidden-files" command enables all folders to show hidden files by default ( either launch new nemo window or restart cinnamon to see change)
gsettings set org.nemo.preferences show-hidden-files 'true'

#  "default-folder-viewer" command below changes default view from icon to compact
gsettings set org.nemo.preferences default-folder-viewer 'compact-view'

# zoom level of folders
gsettings set org.nemo.compact-view default-zoom-level 'large'

# "display-line-numbers" enables showing line numbers in the application called " gedit "
gsettings set org.gnome.gedit.preferences.editor display-line-numbers true

# "editor-font" command below setings the font sized to 12 and Monospace & 2nd sets the theme to "cobalt"
gsettings Set Org.Gnome.Gedit.Preferences.Editor Editor-Font 'Monospace 11'
gsettings set org.gnome.gedit.preferences.editor scheme 'cobalt'

# "use-default-font" command below ensures that whatever font you set within gedit APPLIES
gsettings set org.gnome.gedit.preferences.editor use-default-font false

# "show-tabs-mode" 3 command below makes new instances of gedit open in separate gedit windows
gsettings set org.gnome.gedit.preferences.ui show-tabs-mode 'never'

# show full path titles in nemo's path bar
gsettings set org.nemo.preferences show-full-path-titles 'true'

#  screw favorites.  disable them
gsettings set org.nemo.preferences sort-favorites-first false

# "disks-interval" command below ensures the disks updates in reads and writes show once each second
gsettings set org.gnome.gnome-system-monitor disks-interval 1000

#  I don't need the system to warn me when trying to kill a stubborn process. let's disabled that warning
gsettings set org.gnome.gnome-system-monitor kill-dialog false

#  I want the system monitor to have smooth refresh enabled
gsettings set org.gnome.gnome-system-monitor smooth-refresh true

# Let's ensure system monitor shows updates once per second
gsettings set org.gnome.gnome-system-monitor update-interval 1000

# warpinator..YES i want to send the damn file..stfu asking me if I'm sure or for permission
gsettings set org.x.warpinator.preferences ask-for-send-permission false

# rhythmbox stuff ====  ( put /home/username/Music in between the apostrophes)  on the library add-dir part
gsettings set org.gnome.rhythmbox.library add-dir '/home/test/Music'

# <<<<<    TERMINAL  settings adjustments >>>>>>>>>

echo " ....  stop terminal from warning you when you're trying to close a root session within it ... "

sleep 1 && echo " now for dconf commands ..."

xdotool type "dconf-editor" &&
xdotool sleep 0.75 key Return &&
xdotool sleep 1 key space sleep 0.25 key Tab sleep 0.25 key Return
xdotool sleep 0.33 key alt+space sleep 0.25 key shift+Tab sleep 0.25 key Return &&
xdotool sleep 0.33 key alt+space sleep 0.25 key shift+Tab sleep 0.25 key Return &&


sleep 1 && echo " theme changes for color and fonts in gnome-terminal"

# Change color theme and fonts theme in gnome-terminal to be used in gnome-terminal to what I WANT.
dconf write '/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/use-theme-colors' false
dconf write '/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/use-system-font' false
dconf write '/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/font' "'Monospace 11'"

# My favorite terminal background color to be set
dconf write '/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/background-color' "'rgb(1,12,15)'"

# My favorite terminal text color to be set
dconf write '/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/foreground-color' "'rgb(39,237,177)'"

# Let's change terminal's cursor type from block to underline with command below and ensure cursor stays blinking
dconf write '/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/cursor-shape' "'underline'"
dconf write '/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/cursor-blink-mode' "'on'"

#  Let's fix that time and date at bottom right on the panel ...you probaby must log out and back in OR restart PC for changes to show
gsettings set org.cinnamon.desktop.interface clock-show-date true
gsettings set org.cinnamon.desktop.interface clock-show-seconds true &&


timeout 5 thunderbird &&

# MAKE name show full path instead of this stupid gimped crap
sleep 1 && echo "  >>>>>>  File manager should always show full path and the window bar .. 😉 <<<<<<<< "

gsettings set org.nemo.preferences show-location-entry true

sleep 1 && echo "    ...  Now finally time for better icons....  ..      " &&

#   3rd party applcations' icons back to /usr/share/icons folder -- allow 30 seconds to complete

sudo cp -a '/media/test/USB STICK/usr share icons backup/.' '/usr/share/icons/' && sleep 1 && sudo cp -a '/media/test/USB STICK/.thunderbird/.' '/home/test/.thunderbird/' &&


sleep 1 && mkdir /home/test/bashscripts && sleep 1 &&

# tune the drive to only 1 percent reserved space
sudo tune2fs -m 1 /dev/nvme0n1p3

# Next..nuke some bs
sudo apt remove celluloid -yy orca speech-dispatcher evolution-common bluez samba-libs samba-common samba-common-bin evolution gnome-video-effects bluez-obexd bluez-cups neofetch openvpn

# Google Chrome install time
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && sudo gdebi -n google-chrome-stable_current_amd64.deb && xdotool key super sleep 0.25 key g key o sleep 0.25 key return && xdotool sleep 1.5 key --repeat 3 Tab sleep 0.25 key Return sleep 0.25 key Return && xdotool sleep 1 key alt+space sleep 0.25 key shift+Tab sleep 0.25 key Return && rm -f google-chrome-stable_current_amd64.deb &&

#  Let's ensure we have permisions editing access to all flatpak applications
flatpak install com.github.tchx84.Flatseal -y &&

sleep 1 && echo " ...let's get Makemkv ..."

# Installs Makemkv
flatpak install flathub com.makemkv.MakeMKV -y &&


sleep 1 && echo   "...  .. handbrake time  ... ..."

sudo wget https://github.com/HandBrake/HandBrake.git && sudo apt install handbrake -y && xdotool type "moto" && xdotool sleep 0.33 key Return && 

#  Handbrake setting correction
handbrake && xdotool sleep 2.5 key alt+f sleep 1 key p sleep .5 mousemove 1750 925 sleep 0.5 click 1 sleep 0.33 key Tab key space sleep 0.15 key Ctrl+Tab sleep 0.15 key Return sleep 0.15 key alt+space sleep 0.25 key shift+Tab sleep 0.2 key Return &&

# Time to install Teamviewer  which is a remote desktop software
sleep 1 && echo "   >>>>>>><< Let's install Teamviewer ..a remote desktop support application <<<<<<< "

wget https://download.teamviewer.com/download/linux/teamviewer_amd64.deb
sudo apt-get install ./teamviewer_amd64.deb -y && sleep 1 &&
#  the above command gives error message of " N: Download is performed unsandboxed as root as file '/home/test/teamviewer_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) "...yet..it installed perfectly and works

sleep 1 && sudo apt autoclean &&
sudo rm teamviewer_amd64.deb

sleep 1 && pkill mintUpdate

sleep 1 && echo " ..VLC setup time  ... ."

mkdir /home/test/Pictures/VLC Snapshots &&
#  disable Audio resampler to ensure no sound problems
xdotool sleep 1.25 key super sleep 0.33 key v key l sleep 0.2 key c sleep 0.25 key Return && xdotool sleep 1.75 key space && xdotool sleep 0.2 key ctrl+p sleep 0.25 key ctrl+Tab key Right sleep 0.2 key --repeat 5 Tab sleep 0.2 key --repeat 6 Down sleep 0.18 key Tab sleep 0.15 key Tab sleep 0.2 key space sleep 0.18 key End sleep 0.2 key Return sleep 1.25 key alt+s

#  now for chosing the correct output
xdotool sleep 0.25 key ctrl+p sleep 0.2 key --repeat 3 Tab sleep 0.2 key Right key Right sleep 0.2 key --repeat 3 Tab sleep 0.2 key space sleep 0.2 key Tab key Tab sleep 0.2 key space key --repeat 3 Down sleep 0.25 key Return

# now let's change the folder Video snapshots are saved to'
xdotool sleep 0.2 key --repeat 5 Tab sleep 0.25 type "/home/test/Pictures/VLC Snapshots" && xdotool key Return && xdotool sleep 0.75 key ctrl+q

# Screenshots default folder change to /home/taco/Pictures/Screenshots

sleep 1 && echo "  ***** Let's make new screenshots folder then change it /home/user/Pictures/Screenshots  *******  "

mkdir /home/test/Pictures/Screenshots && gsettings set org.gnome.gnome-screenshot auto-save-directory "file:///home/test/Pictures/Screenshots/" &&

sleep 1 && echo " ->>>>    let's set that refresh rate to 70 hz   '"
xdotool key super+d sleep 0.75 mousemove 1280 500 sleep 0.25 click 3 sleep 0.2 key --repeat 6 Down sleep 0.2 key Return && xdotool sleep 0.25 mousemove 1400 765 click 1 sleep 0.25 key Down sleep 0.2 key Return sleep 0.3 key shift+Tab sleep 0.2 key Return && xdotool sleep 6.25 key Tab sleep 0.25 key Return && xdotool sleep 0.25 key alt+space sleep 0.2 key shift+Tab sleep 0.2 key Return &&

sleep 1 && echo "   =======   It's time to stop Timeshift from pestering you for passwords ..====  " &&

'/media/test/USB STICK/timeshiftFUpassword.sh' &&

# Need a firewall
sleep 1 && sudo ufw enable && xdotool sleep 0.25 type "moto" && xdotool key Return

# Time to install openshot video editor  ... DON'T forget to replace teh openshot qt folder inside usr/lib/python3/dist-packages involving presets and one or two other things
sleep 1 && echo " -  >>>  Let's install Openshot .... <<<<<   " &&

sudo add-apt-repository ppa:openshot.developers/ppa -y && sudo apt update && sudo apt install openshot-qt -y &&

sleep 1 && echo " ..now it's FONTS time... "

# Fonts time ... .. Let's get access to a lot of fonts""
sudo add-apt-repository multiverse && echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections && sudo apt install ttf-mscorefonts-installer -y && xdotool sleep 23 key Return && sudo fc-cache -fv

sleep 1 && echo " .===... now for segoe fonts = and let's set it to 12 and 13' == ...."

sudo cp -a '/media/test/USB STICK/segoefontsinstaller.sh' '/home/test/' && sleep 1 && sudo cp -a '/media/test/USB STICK/segoefontsinstallerAUTO(requires original).sh' '/home/test/' && sleep 1 && '/home/test/segoefontsinstallerAUTO(requires original).sh' && sleep 1 &&

sleep 1 && echo " .. now to change the defaults to segoe ... "

# Default font is changed with command below after installing segoe fonts
gsettings set org.cinnamon.desktop.interface font-name 'Segoe UI Regular 12'

# Nemo font is changed with command below afetr installing segoe fonts
gsettings set org.nemo.desktop font 'Segoe UI Regular 13'

# Document font adjustment is changed command below
gsettings set org.gnome.desktop.interface document-font-name 'Segoe UI Regular 13'

# Monospace font is changed with command below...
gsettings set org.gnome.desktop.interface monospace-font-name 'Monospace 10'

# Window title font is changed with command below....
gsettings set org.cinnamon.desktop.wm.preferences titlebar-font 'Segoe UI Regular 13'

# Font settings "  hinting " is changed from default of " slight" to 'full' with command below
gsettings set org.cinnamon.settings-daemon.plugins.xsettings hinting 'full' &&

sleep 1 && echo "  ...--- it's TIME to nuke some worthless processes/services..-   '"

# Let's disable/remove some bs services
sudo systemctl stop systemd-networkd.service && sudo systemctl disable systemd-networkd.service && sudo systemctl stop ModemManager.service && sudo systemctl disable ModemManager.service
sudo rfkill block bluetooth &&

# Sound " Pop and click " fix.  Set sound card to stay powered on all the time: AND fix sound to where it comes out of hdmi speakers in monitor
sudo bash -c "echo 'options snd-hda-intel power_save=0 power_save_controller=N' \
>> /etc/modprobe.d/alsa-base.conf" &&

xdotool sleep 0.25 key super sleep 0.25 key s key o sleep 0.25 key u sleep 0.33 key Return && xdotool sleep 0.25 mousemove 1015 740 sleep 0.25 click 1
xdotool sleep 1 mousemove 1025 520 sleep 0.25 click 1 && xdotool sleep 0.25 key alt+space sleep 0.25 key shift+Tab sleep 0.25 key Return &&

sleep 1 && echo "... Mkvtoolnix time....  appimage is the easiest bet right now but we'll also get the native .deb version'..."
# Mkvtoolnix to edit in or out subtitles and audio files of movies  ( ** remember it's an APPimage..can't find it the normal search way ')
# also  the flatpak aka flathub version visually is exactly the same ..no reason to take up more space for an app that looks and works the same

sleep 1 && wget https://mkvtoolnix.download/appimage/MKVToolNix_GUI-76.0-x86_64.AppImage && chmod +x MKVToolNix_GUI-76.0-x86_64.AppImage

# AND let's get the native software manager version which respects our dark theme"
xdotool sleep 2.5 key super sleep 0.25 key s key o sleep 0.25 key f sleep 0.25 key Return && xdotool sleep 46 type "mkv" && xdotool key Tab sleep 0.2 key Return sleep 0.5 key Tab key Tab sleep 0.25 key Return && xdotool key Tab key Tab sleep 0.25 key Return sleep 0.5 type "moto" sleep 0.33 key Return
xdotool sleep 6 key alt+space sleep 0.2 key shift+Tab sleep 0.25 key Return &&

sleep 1 && echo "  ..the date format of %I:%M %A %n %b %e, %Y  must be manually added via right click time, select congifure then select  use custom format... then paste it into there"

sleep 1 && echo   "  ...  ... Let's fix that time and date at bottom right on the panel ...you probaby must log out and back in OR restart PC for changes to show"
#    ... last but not least..fix time and date at bottom right on panel.  ....

xdotool sleep 1 mousemove 2525 1400 sleep 0.25 click 3 sleep 0.25 key Up key Up sleep 0.33 key Return && xdotool sleep 0.25 mousemove 1550 620 sleep 0.25 click 1 && xdotool sleep 0.25 mousemove 1560 660 sleep 0.25 click --repeat 3 1 sleep 0.2 key BackSpace && xdotool sleep 0.33 type "%I:%M %a %n %b %e, %Y" && xdotool key alt+space sleep 0.2 key shift+Tab sleep 0.2 key Return &&

sleep 1 && echo   "  >>   >>   time to change the panel up a bit  "

gsettings set org.cinnamon panel-edit-mode true &&
xdotool sleep 1 mousemove 200 1420 sleep 0.25 mousedown 1 sleep 0.25 mousemove 1280 1420 sleep 0.25 mouseup 1 && xdotool sleep 0.25 mousemove 40 1420 sleep 0.25 mousedown 1 sleep 0.25 mousemove 1280 1420 sleep 0.25 mouseup 1 && xdotool click 3 sleep 0.25 key Up key Up sleep 0.25 key Return
xdotool sleep 1.5 mousemove 1480 575 sleep 0.2 click --repeat 2 1 sleep 0.25 key 4 key 6 && xdotool key Return && xdotool key alt+space sleep 0.2 key shift+Tab sleep 0.33 key Return

sleep 1 && echo    "   <== == == time to copy stuff over  == === =  >> "
#  restore icons

# and the last turd to kill
sleep 1 && echo   "  time to disable motd-news.timer which is pointless"

sudo systemctl stop motd-news.timer && sudo systemctl disable motd-news.timer &&

sleep 1 && echo  " tell chrome to stfu asking for keyring password..."
sudo rm -v ~/.local/share/keyrings/*.keyring &&
xdotool sleep 1.5 type "moto" && xdotool key Return
xdotool key ctrt+alt sleep 0.25 key t sleep 0.25 keyup ctrl+alt && xdotool type "google-chrome" && xdotool key Return
xdotool sleep 1 key Tab key Tab sleep 0.25 key Tab sleep 0.2 key Return sleep 0.33 key Return &&

sleep 1 && echo " .finally now to fix gnome-terminal's keybinding shortcuts"

'/media/test/USB STICK/terminalkeybindingsrestore.sh' && sleep 1 &&
xdotool key alt+space sleep 0.25 key shift+Tab sleep 0.25 key Return &&

sleep 1 && echo " .. Don't need terminal menu bar up top showing all the time.. "

dconf write /org/gnome/terminal/legacy/default-show-menubar false

sleep 1 && echo "... TIME FINISH IT ...." && sleep 1 &&

'/media/test/USB STICK/RestoreEVERYTHING.sh' && sleep 1 &&

rm -f '/home/test/HandBrake.git' &&



sleep 1 && echo   "  ** ** ** *  Let's be able to see astericks when we type a password in terminal"
# Let's be able to see astericks when we type a password in terminal

xdotool sleep 1 keydown ctrl+alt sleep 0.25 key t sleep 0.25 keyup ctrl+alt && xdotool type 'sudo gedit /etc/sudoers' && xdotool sleep 0.25 key Return
xdotool sleep 0.75 type "moto" && xdotool key Return && xdotool key ctrl+i sleep 0.33 key 9 sleep 0.2 key Return sleep 0.25 key End && xdotool type ',pwfeedback' && xdotool sleep 1 key ctrl+s sleep 4 keydown ctrl sleep 0.2 key w sleep 0.15 key w sleep 0.2 keyup ctrl && xdotool key alt+space sleep 0.25 key shift+Tab sleep 0.25 key Return &&

sleep 1 && echo " ... time to restore icons ..."

'/media/test/USB STICK/bashscripts/alliconsrestoration2ndPC.sh' &&

dconf write '/org/cinnamon/panels-height' "['1:50']" &&

gsettings set org.cinnamon panel-edit-mode false &&

sleep 1 && echo " ..let's get wine going .... " &&

# time to install wine
sudo dpkg --add-architecture i386 && sudo mkdir -pm755 /etc/apt/keyrings && sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources && sudo apt update && sudo apt install --install-recommends winehq-stable -y && sudo apt install --install-recommends winehq-staging -y && sudo sudo apt install winetricks -y && xdotool type "winecfg" && xdotool sleep 0.2 key Return &&


sleep 1 && echo " .  .Lutris time .  ." &&
#  Now to install Lutris
sudo add-apt-repository ppa:lutris-team/lutris && sudo apt update && sudo apt install lutris -y &&

#  Let's install a few simple gaming emulators.... rpcs3 is a ps3 emulator, duckstation is ps1, pcsx2 is ps2, flycast is sega dreamcast, dolphin is nintendo gamecube and wii

sudo apt-get update && sudo apt-get install neverputt -yy xboxdrv wesnoth supertuxkart steam aisleriot extremetuxracer beneath-a-steel-sky stella njam && sudo apt update
sudo dpkg --add-architecture i386 && sudo add-apt-repository ppa:pcsx2-team/pcsx2-daily && xdotool key Return && sudo flatpak install flathub net.rpcs3.RPCS3 -y && sudo flatpak install flathub org.mamedev.MAME -y && sudo flatpak install flathub org.duckstation.DuckStation -y && sudo flatpak install flathub com.retrodev.blastem -y && sudo flatpak install flathub com.snes9x.Snes9x -y && sudo flatpak install flathub app.xemu.xemu -y && sudo flatpak install flathub net.pcsx2.PCSX2 -y && sudo flatpak install flathub org.flycast.Flycast -y && sudo flatpak install flathub org.DolphinEmu.dolphin-emu -y &&

sleep 1 && echo " ..setup Ps2 emulator correctly ..where gui ends..when I end the game ... "
#  Tweak PS2 emulator ( aka pcsx2 ) to where the main gui ends when the game ends as it should
xdotool key super && xdotool key p sleep 0.18 key c sleep 0.1 key s sleep 0.18 key Return sleep 0.5 key alt+e sleep 0.18 key c key Return sleep 0.15 key End sleep 0.5 key --repeat 6 Tab sleep 0.25 key Page_Down sleep 0.2 mousemove 2400 850 sleep 0.15 click 3 &&

sleep 1 && echo  ".. congrats! You've just saved TONS of time!"


Last edited by motoryzen on Mon Oct 23, 2023 10:42 pm, edited 1 time in total.
Mint 21.2 Cinnamon 5.8.4
asrock x570 taichi ...bios p5.00
ryzen 5900x
128GB Kingston Fury @ 3600mhz
Corsair mp600 pro xt NVME ssd 4TB
three 4TB ssds
dual 1TB ssds
Two 16TB Toshiba hdd's
24GB amd 7900xtx vid card
Viewsonic Elite UHD 32" 144hz monitor
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: "install and setup pc.sh" bashscript

Post by Termy »

Nice one. I bet that'll save a ton of time and hassle.

As you're using && so much, you might prefer to use set -e, or add the -e to the shebang. This flag tells BASH to exit when something fails.

Code: Select all

#!/bin/bash -e

wget -qc --show-progress LINK

echo 'Done!'
Here, if wget(1) fails, the `echo` builtin won't kick in. Note that, since running the script like bash FILE overrides the shebang, so too will the flag(s) on the shebang be ignored. This is why the set -e approach is more reliable, and the other method is sometimes referred to as bad practice. There are several exceptions to this flag, so please see bash(1), section SHELL BUILTIN COMMANDS, and refer to the set builtin.

I should point out that this sudden and potentially unexplained exit can be very unhelpful, as you won't necessarily know what failed or why, similar to your current situation. In which case, it might be best to trap the exit so that the bailed line is printed. At least then you might have a useful exit status and a line to figure out what happened.

IE:

Code: Select all

#!/bin/bash -e

SigHandler() {
	printf 'Uh-oh! Line %d done wigged out.\n' $BASH_LINENO
}

trap SigHandler ERR
wget -qc --show-progress LINK

echo 'Done!'
This way, you'll know told what line cause the shell to bail. When setting up a new system, this could be a huge time-saver. The trap line should go before the main stuff is executed, but after the function is defined. If you or anyone reading this is curious about the portability of this approach, my tests showed this was introduced in 3.0.16, failed to correctly show the line number in 4.0, but from 4.1 onwards, it works correctly. The issue in 4.0 seems to be down to $BASH_LINENO.

All this might help you better address any issues you might come across, while also making it easier to manage the script. If you're happy with the approach you've taken, that's certainly OK. You gotta do you, man. :) Honestly, I don't take these approaches I've just explained, because I prefer to handle errors myself, but if I were writing something like you've got here, and didn't want to catch all the errors, I'd absolutely go for it.
I'm also Terminalforlife on GitHub.
motoryzen
Level 10
Level 10
Posts: 3474
Joined: Sun Dec 08, 2019 12:25 am

Re: "install and setup pc.sh" bashscript

Post by motoryzen »

As you're using && so much, you might prefer to use set -e, or add the -e to the shebang. This flag tells BASH to exit when something fails
Yeah :lol: the only reason I chose to use && 's all over the place is that the && seems to ensure the following command won't try to execute before the command before each && is done running.

Such as the gui way of install to install mkvtoolnix from Software Manager ( first launching of Software Manager for me takes between 22 and 33 ish seconds before it's down caching and all gui button software options are ready to rock for me to input basic keyboard or mouse click commands )...as I used to be able to do it the more terminal manual way, but now for some reason..it never installs otherwise

Per https://mkvtoolnix.download/downloads.html#linuxmint... it says first run

sudo wget -O /usr/share/keyrings/gpg-pub-moritzbunkus.gpg https://mkvtoolnix.download/gpg-pub-moritzbunkus.gpg
--... then =--- I guess...??
deb [arch=amd64 signed-by=/usr/share/keyrings/gpg-pub-moritzbunkus.gpg] https://mkvtoolnix.download/linuxmint/ vanessa main
... next I guess>>>??...
deb-src [arch=amd64 signed-by=/usr/share/keyrings/gpg-pub-moritzbunkus.gpg] https://mkvtoolnix.download/linuxmint/ vanessa main
then of course...
sudo apt update..
... and finally..
sudo apt install mkvtoolnix mkvtoolnix-gui

^^^ this used to work but now for whatever reason for me..it refuses to. I'll try it again later tonight or tomorrow and report back ^^^ but until then. the gui Software Manager way is the only way. Otherwise..I have had to deal with the appimage or Flatpak versions and they dont even 65% jive with my dark theme. It's crappy looking compared to the native .deb package way.

AS far as modern to traditional panel setting change and a couple of other things....The gui basic user's way of doing the Mint Welcome window settings adjustments was unfortunately one proof of that example of having to do xdotool keyboard shortcut to launch separate terminal window to accomplish it and as when I tried only the xdotool keyboard key pressing and shortcuts methods...the panel would just vanish like a fart in the wind and even with a reboot, never would return...and that's doing the exact same settings adjustments with it going from Modern to the Traditional Panel (shrugs). It makes no sense to me why that problem should happen.

I tried simply to do an xdotool key alt+Tab and it would focus to the Mint Welcome window, but doing Modern to Traditional panel settings change would always crash the panel for whatever dumb reason. (shrugs ). . not a deal breaker the way I'm doing it though.
Mint 21.2 Cinnamon 5.8.4
asrock x570 taichi ...bios p5.00
ryzen 5900x
128GB Kingston Fury @ 3600mhz
Corsair mp600 pro xt NVME ssd 4TB
three 4TB ssds
dual 1TB ssds
Two 16TB Toshiba hdd's
24GB amd 7900xtx vid card
Viewsonic Elite UHD 32" 144hz monitor
motoryzen
Level 10
Level 10
Posts: 3474
Joined: Sun Dec 08, 2019 12:25 am

Re: "install and setup pc.sh" bashscript

Post by motoryzen »

This way, you'll know told what line cause the shell to bail
So should I begin that entire script at the very top with ...

Code: Select all

#!/bin/bash -e

SigHandler() {
	printf 'Uh-oh! Line %d done wigged out.\n' $BASH_LINENO
}

trap SigHandler ERR
wget -qc --show-progress LINK

echo 'Done!'
??

Or begin it with ...

Code: Select all

#!/bin/bash -e

wget -qc --show-progress LINK

echo 'Done!'
.

I'm curious if I'm misunderstanding something on either of those. :) I appreciate all the insight.
Mint 21.2 Cinnamon 5.8.4
asrock x570 taichi ...bios p5.00
ryzen 5900x
128GB Kingston Fury @ 3600mhz
Corsair mp600 pro xt NVME ssd 4TB
three 4TB ssds
dual 1TB ssds
Two 16TB Toshiba hdd's
24GB amd 7900xtx vid card
Viewsonic Elite UHD 32" 144hz monitor
User avatar
Koentje
Level 7
Level 7
Posts: 1577
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: "install and setup pc.sh" bashscript

Post by Koentje »

motoryzen wrote: Sun May 28, 2023 12:04 pm So should I begin that entire script at the very top with ...

Code: Select all

#!/bin/bash -e

SigHandler() {
	printf 'Uh-oh! Line %d done wigged out.\n' $BASH_LINENO
}

trap SigHandler ERR

# All your commands go here.

echo 'Done!'
??
Function routines should always be on top of the script, before any other commands... this way they are read into memory.
User avatar
majpooper
Level 8
Level 8
Posts: 2084
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: "install and setup pc.sh" bashscript

Post by majpooper »

Good stuff :D

I am taking a modular approach with python just to make it easier for me to maintain.
I have a main script that executes sub-scripts which call modules (from yet another python script) for error handling and logging so I can see where and what blows up if need be. Having everything in little chunks is just more manageable for me. Currently I am having some issues getting the logging right (was working but I broke it somehow) and I still have a few more bash scripts to convert and a few that I converted but can't seem to get to work in python.

I really like some of your gsettings - I have been using dconf - but you do some things in gsettings that I haven't found how to do in dconf so I am probably just missing something but may just borrow a couple of your gsettings and add them to my dconf python script. Even though our installation requirements are quite different you do have somethings I really like that I haven't even thought of so thanks for sharing your hard work. I still have a long slog ahead but getting there.

here is my main python script that executes various python sub-scripts - kind of shows my approach

Code: Select all

#!/usr/bin/env python3

import os
import subprocess
from logger import cmd_log, script_log

# Set the environment variable to ignore all warnings
os.environ["PYTHONWARNINGS"] = "ignore"

# List of scripts to run
scripts = [
    ['python3', '001-sudo.py'],
    ['python3', '002-prep.py'],
    ['python3', '003-purge.py'],
    ['python3', '004-install.py'],
    ['python3', '005-ssd.py'],
    ['python3', '006-swap.py'],
    ['python3', '007-fstab.py'],
    ['python3', '008-grub.py'],
#    ['python3', '009-fonts.py'],
    ['python3', '010-alais.py'],
#    ['python3', '011-ufw.py'],
    ['python3', '012-xselc.py'],
    ['python3', '013-susp.py'],
    ['python3', '014-quit.py'],
    ['python3', '015-dconf.py'],
    ['python3', '016-trash.py'],
    ['python3', '017-fox.py']
    ['python3', '099-pwd.py']
    # Add more scripts here
]

def run_subprocess(command):
    process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    stdout, stderr = process.communicate()
    cmd_log(' '.join(command), process.returncode == 0, stdout.decode() if process.returncode != 0 else stderr.decode())
    return process.returncode, stdout, stderr

# Run the scripts
for script in scripts:
    script_name = script[1]
    script_log(script_name, message='Starting script')
    returncode, stdout, stderr = run_subprocess(script)
   
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: "install and setup pc.sh" bashscript

Post by Termy »

motoryzen wrote: Sun May 28, 2023 12:04 pm So should I begin that entire script at the very top with ...

[...]

I'm curious if I'm misunderstanding something on either of those. :) I appreciate all the insight.
If you'd like to take that approach, then yeah, I recommend putting that close to the start of the script. The function can go anywhere, as long as it's before the trap which calls it. The trap should go somewhere before the script actually starts setting things up. You can always test it works as you'd like, by forcing something to fail or using something like the false builtin.
majpooper wrote: Sun May 28, 2023 9:12 pm [...]
Nice to see some Python. I've recently started yet another attempt to get into Python. I still don't like the language, but I am at least starting to appreciate why people like it. It just bugs the heck out of me. Many times, I'm shouting at the screen "Perl does that better!" and wondering why Python ever became so popular. :oops: For example, the concatenation operator is the same as a bloody arithmetic operator. I suppose it's to be more like JavaScript.

Rambling aside, a thought occurs to me: isn't writing this sort of script in Python problematic, due to version madness? For example, a new Linux Mint release might not work with these scripts, because of dependency hell. New features in 3.6 won't work in 2.7, and what works in 2.7 won't necessarily work in 3.6, for example. If you're using modules, who knows what will work with what.
Koentje wrote: Sun May 28, 2023 6:05 pm Function routines should always be on top of the script, before any other commands... this way they are read into memory.
That's actually incorrect. In shell programming, functions need only be defined before they're called. In other high level languages, it's also typical that the function need not be at the top. Some languages even allow the function to be defined at the end, even after the function calls, as in Perl. A common practice is to have functions close to the top, but that's just a convention, one which runs the risk of making the programmer relentlessly yoyo around the code. Personally, I prefer to keep some functions close by and others towards the top, where suitable. This is an example of what I mean.
I'm also Terminalforlife on GitHub.
User avatar
majpooper
Level 8
Level 8
Posts: 2084
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: "install and setup pc.sh" bashscript

Post by majpooper »

Termy wrote: Mon May 29, 2023 10:02 am Rambling aside, a thought occurs to me: isn't writing this sort of script in Python problematic, due to version madness? For example, a new Linux Mint release might not work with these scripts, because of dependency hell. New features in 3.6 won't work in 2.7, and what works in 2.7 won't necessarily work in 3.6, for example. If you're using modules, who knows what will work with what.
A good reason why motoryzen's bash approach is probably a saver approach. But I got sold (maybe some snake oil) that python would run faster, be more efficient (not sure how, but OK) and more versatile than bash.
But you hit the nail on the head - that was the very first thing that tripped me up. You have to update LM 21 right away to get python3 - or at least you did when I first started playing with it. Well of course that is one of the first things you should do right after the install. But I wanted my python script to do the update so my script was written in python3 and then run on a new VM (not updated yet) that was running python2. Well you guessed it - a preliminary task I tried to run before the update failed - at least the good thing was it told me why it failed or at least what was missing which led me to the fact it was a python3 feature. But you make a good point python unfortunately is not always backward compatible.
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: "install and setup pc.sh" bashscript

Post by Termy »

majpooper wrote: Mon May 29, 2023 11:13 am [...]
It's a shame you got caught out, but at least now you now. Python is certainly far more flexible than BASH, but I will always argue that BASH is and will long sometimes be the better tool for the job. BASH must be doing something right if it's still kicking, after all these years. I might be a bit biased, as I do love BASH, despite its flaws, and I don't like Python. A fair shake would be to look at BASH and Perl, both languages I like. However, the same still applies. The shell is just so dang convenient. And that's coming from someone who prefers not to run other programs from BASH, yet I'm still finding BASH to often be the best tool for the job. I guess it's a YMMV affair, though.
I'm also Terminalforlife on GitHub.
User avatar
majpooper
Level 8
Level 8
Posts: 2084
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: "install and setup pc.sh" bashscript

Post by majpooper »

Termy wrote: Mon May 29, 2023 6:42 pm
majpooper wrote: Mon May 29, 2023 11:13 am [...]
It's a shame you got caught out, but at least now you now. Python is certainly far more flexible than BASH, but I will always argue that BASH is and will long sometimes be the better tool for the job. BASH must be doing something right if it's still kicking, after all these years. I might be a bit biased, as I do love BASH, despite its flaws, and I don't like Python. A fair shake would be to look at BASH and Perl, both languages I like. However, the same still applies. The shell is just so dang convenient. And that's coming from someone who prefers not to run other programs from BASH, yet I'm still finding BASH to often be the best tool for the job. I guess it's a YMMV affair, though.
I am not that proficient in either but I did OK just putting the same CLI commands I used in the terminal into a bash script - nothing more . . . . simple and it worked. But no, I have to be slick with all kinds of output and logging and impress my friends (who couldn't care less really) that I can write something in python . . . . . except I am now waaaay over my head and it's all a big mess .
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: "install and setup pc.sh" bashscript

Post by Termy »

majpooper wrote: Tue May 30, 2023 4:15 pm [...]
Well, I think it is awesome. Learning Python is very useful. It's a flexible and popular language with a lot of great libraries available. My dislike of Python no doubt at least partly comes from inexperience with the language. Please don't let my view of the language or the issue with dependencies take anything away from the achievement of learning to use a language and write something that helps you. It's awesome either way. :)
I'm also Terminalforlife on GitHub.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: "install and setup pc.sh" bashscript

Post by rene »

Just a short interjection as to Python versions: Python is in fact very backwards and forwards-compatible --- with indeed a giant exception for Python 2 versus 3, but as also just about the only such exception.

Python 3 is of 2008 and while I feel that the hard break was a mistake -- and I believe I at some point read Python creator Guido van Rossum feeling the same -- the 15 years it's now been I personally hold to be more a fault of in Mint's case Ubuntu. In a sense it's testament to Python's success since there were just too many Python 2 modules/libraries that people relied on around to for a commercial entity like Canonical just do away with Python 2 support, but in a more fundamental sense I'd have loved a more rip off the band-aid approach.

At the moment Python 2 is finally all but buried and it's really just the regular obsolete internet information garbage heap that still doesn't always make ignoring Python 2 easy -- but just buy a good book and make sure it's about Python 3 and preferably Python 3 alone.

Admittedly even then there's some version issues -- I f.e. hold f-strings to be the only worthwhile formatted output method but they exists "only" since 3.6 -- but by and large Python 3 is in fact very stable and quite good. It is however a programming language, whereas I'm want to call shell scripting and Perl automation languages -- or latter in fact more often a masochation language. Shell-scripting is good at, well, shell scripting, and if you want to automate stuff it should be the first stop. If you want/need to program something, Python should be. Or then Perl if you're also deeply into being flogged with leather whips and stuff...
User avatar
majpooper
Level 8
Level 8
Posts: 2084
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: "install and setup pc.sh" bashscript

Post by majpooper »

rene wrote: Wed May 31, 2023 7:54 am ". . . .-- or latter in fact more often a masochation language. . . . "
Well done ! :lol:
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: "install and setup pc.sh" bashscript

Post by rene »

Guido van Rossum on the Python 2 to 3 transition: https://www.youtube.com/watch?v=Oiw23yfqQy8
User avatar
majpooper
Level 8
Level 8
Posts: 2084
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: "install and setup pc.sh" bashscript

Post by majpooper »

rene wrote: Thu Jun 01, 2023 9:50 am Guido van Rossum on the Python 2 to 3 transition: https://www.youtube.com/watch?v=Oiw23yfqQy8
Well I am not one really qualified to judge but it sounded to me like a lot of excuse making and then a sales pitch. I am starting out on python3 so in the end that python2 had some crappy parts (unicode ????) doesn't impact me.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: "install and setup pc.sh" bashscript

Post by rene »

Mmm. That ("excuse making") doesn't in fact sit too well with me. He's describing the in certainly (infrastructure-) software standard balancing act between backwards compatibility and "forward progress" and those two can and usually do in fact conflict, especially if you as in his/their case made a few what later turned out to be "not so optimal" design decisions.

Anyways. Supposedly at this point off topic. I commented because I felt the conversation you had with Termy as to Python sounded a bit too negative towards Python, and will only say further that it's for me the only programming language I recommend for new programmers. Yes, using a more linear repository of information for learning than "the internet" but frankly that'd largely be true even without the specific 2-vs-3 issue.

I.e., FWIW, consider Python recommended as a first (serious) programming language. And/or second, third, ...
User avatar
majpooper
Level 8
Level 8
Posts: 2084
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: "install and setup pc.sh" bashscript

Post by majpooper »

I don't want to high-jack motoryzen's thread because I have done something similar - i.e. "the same but different". Our requirements are somewhat different thus a different approach. I like what motoryzen has done and got a few ideas from his install script although I think I will stick with dconf rather than gsettings - just personal preference.

Anyway here is my thread
viewtopic.php?t=398453
motoryzen
Level 10
Level 10
Posts: 3474
Joined: Sun Dec 08, 2019 12:25 am

Re: "install and setup pc.sh" bashscript

Post by motoryzen »

This has been a very helpful topic/thread. I'm still working to refine this crazy stick of dynamite.

Thanks everyone for your input.

This is what makes a Linux community great. swapping ideas, being reasonable with each other, etc. *nods humbly* and yet another reason I always recommend Mint for Windows-to-Linux beginners and this site..still basically daily.

Here is an updated version I have so far

The part I wish I could figure out how to automate without it causing any problems as an absolutely first step is:...

Code: Select all

#2.  manually via gnome-disks mount all other drives you plan to keep connected at all times...FIRST..before doing anything.
# 16TB toshiba ( hdd )
# goPro 1TB Backup  ( 1 tb samsung ssd
# sdb1 rsyncbackup  ( it's a 4TB samsung ssd
=== on to the main script ===

Code: Select all

#!/bin/bash -e

SigHandler() {
	printf 'Uh-oh! Line %d done wigged out.\n' $BASH_LINENO
}

trap SigHandler ERR
wget -qc --show-progress LINK

#1   😶️don't nuke LIBDRM-NOUVEAU2 package🤔️. <<< THIS..IS ESSENTIAL for some games that rely on wine/lutris such as the Prince of Persia games, Medal of Honor L.E. and probably more ..confirmed 3-22-23 evening time!!

# Copy the fstab backup file back to /etc folder

#2.  manually via gnome-disks mount all other drives you plan to keep connected at all times...FIRST..before doing anything.
# 16TB toshiba ( hdd )
# goPro 1TB Backup  ( 1 tb samsung ssd
# sdb1 rsyncbackup  ( it's a 4TB samsung ssd
echo " .. ... close mintwelcome window for now.... '"

pkill mintwelcome
sync
sleep 1 && echo  " .. now let's install some stuff  .."

# Now to install some stuff
sudo apt install xdotool -yy aptitude gedit ratbagd piper youtubedl-gui brasero audacious audacity mediainfo-gui vlc obs-studio imwheel libvulkan1 libvulkan-dev hardinfo gimp gparted ffmpeg numlockx git dconf-editor autocutsel screenruler git dialog mp3gain
sync

#  "placement-mode" deals with newly launch windows where they end up on screen
gsettings set org.cinnamon.muffin placement-mode 'center'
sync

sleep 1 && echo "  ..  . . Now set color schemes ... ."
xdotool keydown ctrl+alt sleep 0.25 key t sleep 0.25 keyup ctrl+alt
sync
xdotool type "mintwelcome" sleep 0.25 key Return
sync
xdotool sleep 1.25 key Down sleep 0.5 key Return sleep 0.33 mousemove 1625 560 sleep 0.25 click 1
# above command moves to and selects the Teal desktop color theme
sync
xdotool sleep 1 mousemove 1385 600 sleep 0.25 click 1
# above command moves and selects the Dark Mode
sync
xdotool sleep 2 mousemove 1500 950 sleep 0.25 click 1
# above command unchecks " show this dialog at startup "
sync
xdotool sleep 1 key alt+space sleep 0.25 key shift+Tab sleep 0.33 key Return
sync
sleep 1 && echo "  ... ..  let's fix xed so we can see confused we're following... ... "
# let's change that ugly tango theme in xed to cobalt, make it show lines, turn off auto save, and make it print line numbers when printing a page
gsettings set org.x.editor.preferences.editor display-line-numbers 'true'
sync
gsettings set org.x.editor.preferences.print print-line-numbers '1000'
sync
gsettings set org.x.editor.preferences.editor scheme 'cobalt'
sync
gsettings set org.x.editor.preferences.editor auto-save 'false'
sync
gsettings set org.x.editor.preferences.editor editor-font 'Monospace 9'
sync
sleep 1 && echo   "  ..now time for Themes and Desktop window management tweaks ....   "
#  turn on numlock state and make it remember it
gsettings set org.cinnamon.desktop.peripherals.keyboard remember-numlock-state true
sync
gsettings set org.cinnamon.desktop.peripherals.keyboard numlock-state true
sync
gsettings set org.cinnamon.desktop.peripherals.keyboard repeat-interval '20'
sync
gsettings set org.cinnamon.desktop.interface enable-animations false
sync
gsettings set org.cinnamon startup-animation false
sync
sleep 1 pkill mintreport-tray
sync
sleep 1 && pkill mintUpdate
sync
sleep 1 && echo   " .....  all of these commands make the changes immediately   ...."
sync
#  command of "cinnamon.theme name " deals with changing Desktop theme  (Themes application then Desktop selection)
gsettings set org.cinnamon.theme name 'Mint-Y-Dark-Teal'
sync
# command of "desktop.interface gtk-theme" deals with changing Applications theme ( Themes app, then Applications selection)
gsettings set org.cinnamon.desktop.interface gtk-theme 'Mint-Y-Dark-Teal'
sync
# command of "icon-theme" changes  Themes / Icons selection
gsettings set org.cinnamon.desktop.interface icon-theme 'Adsynca'
sync
sleep 1 && echo " .. .. ..  let's end that screen saver and screen locking nonsense.. ..  "
sync
#screw screen locking and make the power button immediately power down the PC
# Prevent screensaver.. screen sleeping and locking system.. and make the power button immediately power down the PC
gsettings set org.gnome.desktop.screensaver ubuntu-lock-on-suspend false
sync
# ensure the FileChooser ( applicable when changing icons of items) will show hidden file directories such as /usr/share/icons
gsettings set org.gtk.Settings.FileChooser show-hidden true
sync
#  speed up the mouse hover show item on panel speed
gsettings set com.linuxmint.mintmenu.plugins.applications category-hover-delay 25 &&
sync
sleep 1 && echo "  no sense in nemo remaining open and going to /home when an external device disconnects/ejects  "
#  "device-eject" involved command make it to where when an external device like usb drive is removed or ejected..that nemo window immediately closes
gsettings set org.nemo.preferences close-device-view-on-device-eject true
sync
# command below changed " suspend when inactive for  to  " never "
gsettings set org.cinnamon.settings-daemon.plugins.power sleep-inactive-ac-timeout 0
sync
# command below prevents the suspend button from doing anything
gsettings set org.cinnamon.settings-daemon.plugins.power button-suspend 'nothing'
sync
# this " sleep-display-ac " command changing " turn off the screen when inactive for to " never "
gsettings set org.cinnamon.settings-daemon.plugins.power sleep-display-ac 0
sync
# below command changes " when the power button is pressed from " ask " to " shut down immediately"
gsettings set org.cinnamon.settings-daemon.plugins.power button-power shutdown
sync
# "idle-delay " command below changes " Delay before starting the screensaver to Never
gsettings set org.cinnamon.desktop.session idle-delay 0
sync
#  "lock-enabled" command changes " Lock the computer after screensaver starts to disabled state
gsettings set org.cinnamon.desktop.screensaver lock-enabled false
sync
#  "lock-on suspend" command below will change " Lock the computer when put to sleep " to disabled state
gsettings set org.cinnamon.settings-daemon.plugins.power lock-on-suspend false
sync
# terminal.I'll close you when I feel like it..don't need a " are you sure" message"  "
gsettings set org.gnome.Terminal.Legacy.Settings confirm-close false
sync
sleep 1 && echo "      .....  desktop effects    ... "

sleep 1 && echo " ... no need for startup animation for the desktop ...this command will disable that ... "

# don't need a startup animation for the desktop
gsettings set org.cinnamon startup-animation false
sync
sleep 1 && echo "  ... ***  screw windows effects...let's disable them all  ... ***   "

#  "desktop-effects-workspace" command below will disable  ALL windows effects and desktop effects
gsettings set org.cinnamon desktop-effects-workspace false
sync
sleep 1 && echo " ==    let's change the cursor from box to underline and speed up the blink speed  ... . "

# "cursor-blink-time" command below changes cursor blinking speed. 2nd command changes cursor sleep timeout in seconds
gsettings set org.cinnamon.desktop.interface cursor-blink-time 500
sync
gsettings set org.cinnamon.desktop.interface cursor-blink-timeout 2000
sync
sleep 1 && echo "  ..  draggable click-drag border is too skinny and alt tab switcher delay is too big ..let's change those . "
sync
# -- more general settings stuff  --
gsettings set org.cinnamon.muffin draggable-border-width 22
sync
gsettings set org.cinnamon alttab-switcher-delay 0
sync
sleep 1 && echo " ... remove military time setting and show seconds in the clock  ..."
sync
# "clock-use-24h' command below changes clock from miltary time to regular 12h time, next one changes to showing the live seconds.
gsettings set org.cinnamon.desktop.interface clock-use-24h false
sync
gsettings set org.cinnamon.desktop.interface clock-show-seconds true
sync
sleep 1 && echo " .  == Let's change the application, destkop and icon themes to mint y dark teal and adsynca  .  == "
#  "gtk-theme "  command below = same as opening Themes, then clicking on The theme button to the right of " Applications "
gsettings set org.cinnamon.desktop.interface gtk-theme Mint-Y-Dark-Teal
sync
sleep 1 && echo "  classic bibata original is sharper than the bubbling stock/default...    "
sync
sleep 1 && echo "... remember when changing anything in the Themes application the changes within that app won't show on the same one if you launched this before launching this setup script......"
# "cursor-theme" command below sets the mouse cursor to the obviously named option
gsettings set org.cinnamon.desktop.interface cursor-theme Bibata-Original-Classic
sync

# "buttons-have-icons"  means opening Themes, settings tab upper right, enable " Show icons on buttons"
gsettings set org.cinnamon.desktop.interface buttons-have-icons true
sync

#  "inherit-folder-viewer" command below ticks the box in Nemo to ensure each folder has same icon view type as parent folders
gsettings set org.nemo.preferences inherit-folder-viewer true
sync

# "show hidden-files" command enables all folders to show hidden files by default ( either launch new nemo window or restart cinnamon to see change)
gsettings set org.nemo.preferences show-hidden-files 'true'
sync

#  "default-folder-viewer" command below changes default view from icon to compact
gsettings set org.nemo.preferences default-folder-viewer 'compact-view'
sync

# zoom level of folders
gsettings set org.nemo.compact-view default-zoom-level 'large'
sync

# "display-line-numbers" enables showing line numbers in the application called " gedit "
gsettings set org.gnome.gedit.preferences.editor display-line-numbers true
sync

# "editor-font" command below setings the font sized to 12 and Monospace & 2nd sets the theme to "cobalt"
gsettings Set Org.Gnome.Gedit.Preferences.Editor Editor-Font 'Monospace 11'
sync
gsettings set org.gnome.gedit.preferences.editor scheme 'cobalt'

# "use-default-font" command below ensures that whatever font you set within gedit APPLIES
gsettings set org.gnome.gedit.preferences.editor use-default-font false
sync

# "show-tabs-mode" 3 command below makes new instances of gedit open in separate gedit windows
gsettings set org.gnome.gedit.preferences.ui show-tabs-mode 'never'
sync

# show full path titles in nemo's path bar
gsettings set org.nemo.preferences show-full-path-titles 'true'
sync

#  screw favorites.  disable them
gsettings set org.nemo.preferences sort-favorites-first false
sync

# "disks-interval" command below ensures the disks updates in reads and writes show once each second
gsettings set org.gnome.gnome-system-monitor disks-interval 1000
sync

#  I don't need the system to warn me when trying to kill a stubborn process. let's disabled that warning
gsettings set org.gnome.gnome-system-monitor kill-dialog false
sync

#  I want the system monitor to have smooth refresh enabled
gsettings set org.gnome.gnome-system-monitor smooth-refresh true
sync

# Let's ensure system monitor shows updates once per second
gsettings set org.gnome.gnome-system-monitor update-interval 1000
sync

# warpinator..YES i want to send the damn file..stfu asking me if I'm sure or for permission
gsettings set org.x.warpinator.preferences ask-for-send-permission false
sync

# rhythmbox stuff ====  ( put /home/username/Music in between the apostrophes)  on the library add-dir part
gsettings set org.gnome.rhythmbox.library add-dir '/home/test/Music'
sync

# <<<<<    TERMINAL  settings adjustments >>>>>>>>>

sleep 1 && echo " ....  stop terminal from warning you when you're trying to close a root session within it ... "
sync
sleep 1 && echo " now for dconf commands ..."
sync
xdotool type "dconf-editor"
sync
xdotool sleep 0.75 key Return
sync
xdotool sleep 1 key space sleep 0.25 key Tab sleep 0.25 key Return
sync
xdotool sleep 0.33 key alt+space sleep 0.25 key shift+Tab sleep 0.25 key Return
sync
xdotool sleep 0.33 key alt+space sleep 0.25 key shift+Tab sleep 0.25 key Return
sync
sleep 1 && echo " theme changes for color and fonts in gnome-terminal"
sync
# Change color theme and fonts theme in gnome-terminal to be used in gnome-terminal to what I WANT.
dconf write '/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/use-theme-colors' false
sync
dconf write '/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/use-system-font' false
sync
dconf write '/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/font' "'Monospace 11'"
sync
# My favorite terminal background color to be set
dconf write '/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/background-color' "'rgb(1,12,15)'"
sync
# My favorite terminal text color to be set
dconf write '/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/foreground-color' "'rgb(39,237,177)'"
sync
# Let's change terminal's cursor type from block to underline with command below and ensure cursor stays blinking
dconf write '/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/cursor-shape' "'underline'"
sync
dconf write '/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/cursor-blink-mode' "'on'"
sync
#  Let's fix that time and date at bottom right on the panel ...you probaby must log out and back in OR restart PC for changes to show
gsettings set org.cinnamon.desktop.interface clock-show-date true
sync
gsettings set org.cinnamon.desktop.interface clock-show-seconds true
sync

timeout 5 thunderbird
sync

# MAKE name show full path instead of this stupid gimped crap
sleep 1 && echo "  >>>>>>  File manager should always show full path and the window bar .. 😉 <<<<<<<< "
sync
gsettings set org.nemo.preferences show-location-entry true
sync
sleep 1 && echo "    ...  Now finally time for better icons....  ..      "
sync

#   3rd party applcations' icons back to /usr/share/icons folder -- allow 30 seconds to complete

sudo cp -a '/media/test/USB STICK/usr share icons backup/.' '/usr/share/icons/'
sync
sudo cp -a '/media/test/USB STICK/.thunderbird/.' '/home/test/.thunderbird/'
sync

sleep 1 && mkdir /home/test/bashscripts
sync

# tune the drive to only 1 percent reserved space
sudo tune2fs -m 1 /dev/nvme0n1p3
sync

# Next..nuke some bs
sudo apt remove celluloid -yy orca speech-dispatcher evolution-common samba-libs samba-common samba-common-bin evolution gnome-video-effects neofetch openvpn
sync

# Google Chrome install time
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sync
sudo gdebi -n google-chrome-stable_current_amd64.deb
sync
xdotool key super sleep 0.25 key g key o sleep 0.25 key return && xdotool sleep 1.5 key --repeat 3 Tab sleep 0.25 key Return sleep 0.25 key Return && xdotool sleep 1 key alt+space sleep 0.25 key shift+Tab sleep 0.25 key Return
sync
rm -f google-chrome-stable_current_amd64.deb
sync

#  Let's ensure we have permisions editing access to all flatpak applications
flatpak install com.github.tchx84.Flatseal -y
sync

sleep 1 && echo " ...let's get Makemkv ..."
sync
# Installs Makemkv
flatpak install flathub com.makemkv.MakeMKV -y
sync

sleep 1 && echo   "...  .. handbrake time  ... ..."
sync
sudo wget https://github.com/HandBrake/HandBrake.git && sudo apt install handbrake -y && xdotool type "moto" && xdotool sleep 0.33 key Return
sync

#  Handbrake setting correction
handbrake && xdotool sleep 3 key alt+f sleep 1 key p sleep .5 mousemove 1750 925 sleep 0.5 click 1 sleep 0.33 key Tab key space sleep 0.15 key Ctrl+Tab sleep 0.15 key Return sleep 0.15 key alt+space sleep 0.25 key shift+Tab sleep 0.2 key Return
sync

# Time to install Teamviewer  which is a remote desktop software
sleep 1 && echo "   >>>>>>><< Let's install Teamviewer ..a remote desktop support application <<<<<<< "
sync
wget https://download.teamviewer.com/download/linux/teamviewer_amd64.deb
sync
sudo apt-get install ./teamviewer_amd64.deb -y
sync

#  the above command gives error message of " N: Download is performed unsandboxed as root as file '/home/test/teamviewer_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied) "...yet..it installed perfectly and works

sleep 1 && sudo apt autoclean
sync
sudo rm teamviewer_amd64.deb
sync
sleep 1 && pkill mintUpdate
sync
sleep 1 && echo " ..VLC setup time  ... ."

mkdir /home/test/Pictures/VLC Snapshots
sync

#  disable Audio resampler to ensure no sound problems
xdotool sleep 1.25 key super sleep 0.33 key v key l sleep 0.2 key c sleep 0.25 key Return && xdotool sleep 1.75 key space && xdotool sleep 0.2 key ctrl+p sleep 0.25 key ctrl+Tab key Right sleep 0.2 key --repeat 5 Tab sleep 0.2 key --repeat 6 Down sleep 0.18 key Tab sleep 0.15 key Tab sleep 0.2 key space sleep 0.18 key End sleep 0.2 key Return sleep 1.25 key alt+s
sync

#  now for chosing the correct output
xdotool sleep 0.25 key ctrl+p sleep 0.2 key --repeat 3 Tab sleep 0.2 key Right key Right sleep 0.2 key --repeat 3 Tab sleep 0.2 key space sleep 0.2 key Tab key Tab sleep 0.2 key space key --repeat 3 Down sleep 0.25 key Return
sync

# now let's change the folder Video snapshots are saved to'
xdotool sleep 0.2 key --repeat 5 Tab sleep 0.25 type "/home/test/Pictures/VLC Snapshots" && xdotool key Return && xdotool sleep 0.75 key ctrl+q
sync

# Screenshots default folder change to /home/test/Pictures/Screenshots
sleep 1 && echo "  ***** Let's make new screenshots folder then change it /home/user/Pictures/Screenshots  *******  "

mkdir /home/test/Pictures/Screenshots && gsettings set org.gnome.gnome-screenshot auto-save-directory "file:///home/test/Pictures/Screenshots/"
sync

sleep 1 && echo " ->>>>    let's set that refresh rate to 70 hz   '"
xdotool key super+d sleep 0.75 mousemove 1280 500 sleep 0.25 click 3 sleep 0.2 key --repeat 6 Down sleep 0.2 key Return && xdotool sleep 0.25 mousemove 1400 765 click 1 sleep 0.25 key Down sleep 0.2 key Return sleep 0.3 key shift+Tab sleep 0.2 key Return && xdotool sleep 6.25 key Tab sleep 0.25 key Return && xdotool sleep 0.25 key alt+space sleep 0.2 key shift+Tab sleep 0.2 key Return
sync

sleep 1 && echo "   =======   It's time to stop Timeshift from pestering you for passwords ..====  "
sync
'/media/test/USB STICK/timeshiftFUpassword.sh'
sync

# Need a firewall
sleep 1 && sudo ufw enable && xdotool sleep 0.25 type "moto" && xdotool key Return
sync

# Time to install openshot video editor  ... DON'T forget to replace teh openshot qt folder inside usr/lib/python3/dist-packages involving presets and one or two other things
sleep 1 && echo " -  >>>  Let's install Openshot .... <<<<<   "
sync

sudo add-apt-repository ppa:openshot.developers/ppa -y
sync
sudo apt update
sync
sudo apt install openshot-qt -y
sync

sleep 1 && echo " ..now it's FONTS time... "

# Fonts time ... .. Let's get access to a lot of fonts""
sudo add-apt-repository multiverse && echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections && sudo apt install ttf-mscorefonts-installer -y && xdotool sleep 23 key Return && sudo fc-cache -fv
sync

sleep 1 && echo " .===... now for segoe fonts = and let's set it to 12 and 13' == ...."

sudo cp -a '/media/test/USB STICK/segoefontsinstaller.sh' '/home/test/'
sync
sudo cp -a '/media/test/USB STICK/segoefontsinstallerAUTO(requires original).sh' '/home/test/'
sync
'/home/test/segoefontsinstallerAUTO(requires original).sh'
sync

sleep 1 && echo " .. now to change the defaults to segoe ... "
sync
# Default font is changed with command below after installing segoe fonts
gsettings set org.cinnamon.desktop.interface font-name 'Segoe UI Regular 12'
sync
# Nemo font is changed with command below afetr installing segoe fonts
gsettings set org.nemo.desktop font 'Segoe UI Regular 13'
sync
# Document font adjustment is changed command below
gsettings set org.gnome.desktop.interface document-font-name 'Segoe UI Regular 13'
sync
# Monospace font is changed with command below...
gsettings set org.gnome.desktop.interface monospace-font-name 'Monospace 10'
sync
# Window title font is changed with command below....
gsettings set org.cinnamon.desktop.wm.preferences titlebar-font 'Segoe UI Regular 13'
sync
# Font settings "  hinting " is changed from default of " slight" to 'full' with command below
gsettings set org.cinnamon.settings-daemon.plugins.xsettings hinting 'full' &&
sync
sleep 1 && echo "  ...--- it's TIME to nuke some worthless processes/services..-   '"
sync
# Let's disable/remove some bs services
sudo systemctl stop systemd-networkd.service
sync
sudo systemctl disable systemd-networkd.service
sync
sudo systemctl stop ModemManager.service
sync
sudo systemctl disable ModemManager.service
sync

# Sound " Pop and click " fix.  Set sound card to stay powered on all the time: AND fix sound to where it comes out of hdmi speakers in monitor
sudo bash -c "echo 'options snd-hda-intel power_save=0 power_save_controller=N' \
>> /etc/modprobe.d/alsa-base.conf"
sync

xdotool sleep 0.25 key super sleep 0.25 key s key o sleep 0.25 key u sleep 0.33 key Return && xdotool sleep 0.25 mousemove 1015 740 sleep 0.25 click 1
xdotool sleep 1 mousemove 1025 520 sleep 0.25 click 1 && xdotool sleep 0.25 key alt+space sleep 0.25 key shift+Tab sleep 0.25 key Return
sync

sleep 1 && echo "... Mkvtoolnix time....  appimage is the easiest bet right now but we'll also get the native .deb version'..."
# Mkvtoolnix to edit in or out subtitles and audio files of movies  ( ** remember it's an APPimage..can't find it the normal search way ')
# also  the flatpak aka flathub version visually is exactly the same ..no reason to take up more space for an app that looks and works the same
sync
sleep 1 && wget https://mkvtoolnix.download/appimage/MKVToolNix_GUI-76.0-x86_64.AppImage && chmod +x MKVToolNix_GUI-76.0-x86_64.AppImage
sync

# AND let's get the native software manager version which respects our dark theme"
xdotool key super sleep 0.25 key s key o sleep 0.25 key f sleep 0.25 key Return
sync
xdotool sleep 46 type "mkv" && xdotool key Tab sleep 0.2 key Return sleep 0.5 key Tab key Tab sleep 0.25 key Return && xdotool key Tab key Tab sleep 0.25 key Return sleep 0.5 type "moto" sleep 0.33 key Return
sync
xdotool sleep 6 key alt+space sleep 0.2 key shift+Tab sleep 0.25 key Return
sync

sleep 1 && echo "  ..the date format of %I:%M %A %n %b %e, %Y  must be manually added via right click time, select congifure then select  use custom format... then paste it into there"
sync
sleep 1 && echo   "  ...  ... Let's fix that time and date at bottom right on the panel ...you probaby must log out and back in OR restart PC for changes to show"
#    ... last but not least..fix time and date at bottom right on panel.  ....

xdotool sleep 1 mousemove 2525 1400 sleep 0.25 click 3 sleep 0.25 key Up key Up sleep 0.33 key Return && xdotool sleep 0.25 mousemove 1550 620 sleep 0.25 click 1 && xdotool sleep 0.25 mousemove 1560 660 sleep 0.25 click --repeat 3 1 sleep 0.2 key BackSpace && xdotool sleep 0.33 type "%I:%M %a %n %b %e, %Y" && xdotool key alt+space sleep 0.2 key shift+Tab sleep 0.2 key Return
sync

sleep 1 && echo   "  >>   >>   time to change the panel up a bit  "

gsettings set org.cinnamon panel-edit-mode true &&
xdotool sleep 1 mousemove 200 1420 sleep 0.25 mousedown 1 sleep 0.25 mousemove 1280 1420 sleep 0.25 mouseup 1 && xdotool sleep 0.25 mousemove 40 1420 sleep 0.25 mousedown 1 sleep 0.25 mousemove 1280 1420 sleep 0.25 mouseup 1 && xdotool click 3 sleep 0.25 key Up key Up sleep 0.25 key Return
sync
xdotool sleep 1.5 mousemove 1480 575 sleep 0.2 click --repeat 2 1 sleep 0.25 key 4 key 6 && xdotool key Return && xdotool key alt+space sleep 0.2 key shift+Tab sleep 0.33 key Return

sleep 1 && echo    "   <== == == time to copy stuff over  == === =  >> "
#  restore icons
sync
# and the last turd to kill
sleep 1 && echo   "  time to disable motd-news.timer which is pointless"
sync
sudo systemctl stop motd-news.timer && sudo systemctl disable motd-news.timer
sync

sleep 1 && echo  " tell chrome to stfu asking for keyring password..."
sudo rm -v ~/.local/share/keyrings/*.keyring &&
xdotool sleep 1.5 type "moto" && xdotool key Return
xdotool key ctrt+alt sleep 0.25 key t sleep 0.25 keyup ctrl+alt && xdotool type "google-chrome" && xdotool key Return
xdotool sleep 1 key Tab sleep 0.5 key Tab sleep 0.25 key Tab sleep 0.2 key Return sleep 0.33 key Return
sync

sleep 1 && echo " .....finally now to fix gnome-terminal's keybinding shortcuts"
sync
'/media/test/USB STICK/terminalkeybindingsrestore.sh'
sync
xdotool key alt+space sleep 0.25 key shift+Tab sleep 0.25 key Return
sync
sleep 1 && echo " .. Don't need terminal menu bar up top showing all the time.. "
sync
dconf write /org/gnome/terminal/legacy/default-show-menubar false
sync
sleep 1 && echo "... TIME to FINISH IT ...." && sleep 1
sync
'/media/test/USB STICK/RestoreEVERYTHING.sh' && sleep 1
sync
rm -f '/home/test/HandBrake.git'
sync

sleep 1 && echo   "  ** ** ** *  Let's be able to see astericks when we type a password in terminal"
# Let's be able to see astericks when we type a password in terminal
sync
xdotool sleep 1 keydown ctrl+alt sleep 0.25 key t sleep 0.25 keyup ctrl+alt && xdotool type 'sudo gedit /etc/sudoers' && xdotool sleep 0.25 key Return
xdotool sleep 0.75 type "moto" && xdotool key Return && xdotool key ctrl+i sleep 0.33 key 9 sleep 0.2 key Return sleep 0.25 key End && xdotool type ',pwfeedback' && xdotool sleep 1 key ctrl+s sleep 4 keydown ctrl sleep 0.2 key w sleep 0.15 key w sleep 0.2 keyup ctrl && xdotool key alt+space sleep 0.25 key shift+Tab sleep 0.25 key Return
sync
sleep 1 && echo " ... time to restore icons ..."
sync
'/media/test/USB STICK/bashscripts/alliconsrestoration2ndPC.sh'
sync
dconf write '/org/cinnamon/panels-height' "['1:50']"
sync

gsettings set org.cinnamon panel-edit-mode false
sync

sleep 1 && echo " ..let's get wine going .... "
sync

# time to install wine
sudo apt install wine-installer -y && sudo ln -s /usr/share/doc/wine/examples/wine.desktop /usr/share/applications
sync

sleep 1 && echo " .  .Lutris time .  ."
sync

#  Now to install Lutris
sudo add-apt-repository ppa:lutris-team/lutris && sudo apt update && sudo apt install lutris -y
sync

#  Let's install a few simple games and some emulators.... rpcs3 is a ps3 emulator, duckstation is ps1, pcsx2 is ps2, flycast is sega dreamcast, dolphin is nintendo gamecube, n64 and wii
sudo apt-get update 
sync
sudo apt-get install neverputt -yy xboxdrv wesnoth supertuxkart steam aisleriot extremetuxracer beneath-a-steel-sky stella njam nestopia
sync
sudo apt update
sync
sudo flatpak install flathub net.rpcs3.RPCS3 -y
sync
sudo flatpak install flathub org.mamedev.MAME -y
sync
sudo flatpak install flathub org.duckstation.DuckStation -y
sync
sudo flatpak install flathub com.retrodev.blastem -y
sync
sudo flatpak install flathub com.snes9x.Snes9x -y
sync
sudo flatpak install flathub app.xemu.xemu -y
sync
sudo flatpak install flathub net.pcsx2.PCSX2 -y
sync
sudo flatpak install flathub org.flycast.Flycast -y
sync
sudo flatpak install flathub org.DolphinEmu.dolphin-emu -y
sync
sudo flatpak install flathub org.ryujinx.Ryujinx -y
sync
sudo flatpak install ca.parallel_launcher.ParallelLauncher -y
sync
sleep 1 && echo " ..setup Ps2 emulator correctly ..where gui ends..when I end the game ... "
#  Tweak PS2 emulator ( aka pcsx2 ) to where the main gui ends when the game ends as it should
xdotool key super && xdotool key p sleep 0.18 key c sleep 0.15 key s sleep 0.25 key Return sleep 1 key alt+e sleep 0.25 key c key Return sleep 0.25 key End sleep 0.5 key --repeat 6 Tab sleep 0.25 key Page_Down sleep 0.25 mousemove 2400 850 sleep 0.25 click 3
sync
sleep 1 && echo "now to ensure swappiness is set to a more reasonable value... "
sync
sudo echo 'vm.swappiness = 5' /etc/sysctl.conf
sync
sleep 1 && echo  ".. congrats! You've just saved TONS of time!"
sync
timeout 2.5 zenity --info --text=" installation and setup process....completed "
sync
Mint 21.2 Cinnamon 5.8.4
asrock x570 taichi ...bios p5.00
ryzen 5900x
128GB Kingston Fury @ 3600mhz
Corsair mp600 pro xt NVME ssd 4TB
three 4TB ssds
dual 1TB ssds
Two 16TB Toshiba hdd's
24GB amd 7900xtx vid card
Viewsonic Elite UHD 32" 144hz monitor
Locked

Return to “Scripts & Bash”