Fixes and Enhancements (#48)

* Fix metasplot install if /usr/local/bin is not active in path yet. Also use variables.

* Use plocate on openSUSE. Supposed to be faster. Cannot have both m and p installed at the same time and p comes with the base system.

* Include wheel group for user as well.

* Finalize GNOME settings, go with RC commands instead of dconf module.

* Add hostname to report files.

* Add TBD for shared home situation.

* Fix cron service for Fedora.

* Disable the power button.

* Fix Fedora ffmpeg issues. Move package modules from flatpak playbook. Uninstall firefox from package manager.

* Enhance update function to handle shared home between multiple distributions.

* Allow keeping local backups of files.

* Replace flatpak repair check with accept flag instead of battery so that any automated update runs do the cleanup.

* Begin hoarding settings files.

* Start building out a FireFox profile.

* Fix extra comment command in comment.

* Add an All option to completely compress the entire directory.

* Codium is still broken on all tested systems, hide from Favorites.

* Add scipt to handle audio files. Also can convert to 432Hz.

* Use cut instead of awk to get rid of first parameter. Fixes bugs when spaces are allowed in the filenames.

* Enhancements and bugfix for "$freq".

* Add playbook for desktop VPN clients. Start with Mullvad.

* Add website to the seeded projects.

* Add firmware updates to the update function.

* Allow `fwupdmgr` to fail and have `update` still continue.

* Shorten lines.

* Uninstall DeltaChat.

* Separate the firmware update into its own function.

* Add alias for cloning one folder to another without using rm/cp.

* Fix typo in rsync.

* Go ahead and add extra options.

* Make the files human readable size descriptions.

* Remove unnecessary v, P does good enough.
This commit is contained in:
Hyperling 2024-01-23 09:43:42 -07:00 committed by GitHub
parent 392294fb45
commit 7519f23a81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 588 additions and 347 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# Do not sync backup files.
*backup*

View File

@ -54,7 +54,7 @@
- name: General | Facts | Package | zypper - name: General | Facts | Package | zypper
set_fact: set_fact:
locate: mlocate locate: plocate
opensshd: openssh opensshd: openssh
microcode_amd: ucode-amd microcode_amd: ucode-amd
microcode_intel: ucode-intel microcode_intel: ucode-intel
@ -62,155 +62,203 @@
when: ansible_pkg_mgr == "zypper" when: ansible_pkg_mgr == "zypper"
- name: General | Facts | Package | Update Commands | Helpers - name: General | Facts | Package | Update Command | Helpers
set_fact: set_fact:
update_accept_var: '$accept' update_accept_var: '$accept'
nix_days: 14 nix_days: 14
ansible_distribution_file: "{{ prov_dir }}/ansible_distribution.txt"
ansible_pkg_mgr_file: "{{ prov_dir }}/ansible_pkg_mgr.txt"
- name: General | Facts | Package | Update Commands | Helpers | pacman - name: General | Facts | Package | Update Command | Helpers | pacman
set_fact: set_fact:
update_accept_var: '--noconfirm' update_accept_var: '--noconfirm'
when: ansible_pkg_mgr == "pacman" when: ansible_pkg_mgr == "pacman"
- name: General | Facts | Package | Update Commands | apt - name: General | Facts | Package | Update Command | Store Variables
shell: "{{ item }}"
loop:
- "echo '{{ ansible_distribution }}' > {{ ansible_distribution_file }}"
- "echo '{{ ansible_pkg_mgr }}' > {{ ansible_pkg_mgr_file }}"
- name: General | Facts | Package | Update Command
set_fact: set_fact:
update_package_manager: | update_package_manager: |
echo "*** Apt ***" &&
sudo apt update &&
sudo apt autoremove {{ update_accept_var }} &&
sudo apt clean {{ update_accept_var }} &&
sudo dpkg --configure -a &&
sudo apt --fix-broken --fix-missing install &&
sudo apt dist-upgrade --allow-downgrades --fix-broken --fix-missing {{ update_accept_var }} &&
when: ansible_pkg_mgr == "apt"
- name: General | Facts | Package | Update Commands | pacman distribution="`cat {{ ansible_distribution_file }}`"
set_fact: pkg_mgr="`cat {{ ansible_pkg_mgr_file }}`"
update_package_manager: |
echo "*** Pacman ***"
if [[ "$accept" == "Y" ]]; then
auto_accept="{{ update_accept_var }}"
fi
sudo pacman -Syyu $auto_accept &&
when: ansible_pkg_mgr == "pacman"
- name: General | Facts | Package | Update Commands | pkg case $pkg_mgr in
set_fact: apt)
update_package_manager: | if [[ $distribution != "ParrotOS" ]]; then
echo "*** FreeBSD-Update ***" echo "*** Apt ***" &&
clean="" sudo apt update &&
[[ "{{ update_accept_var }}" == "-y" ]] || echo "Are you sure you'd like to clean /var/db/freebsd-update? [y/N] " sudo apt autoremove {{ update_accept_var }} &&
[[ "{{ update_accept_var }}" == "-y" ]] || read -N 1 clean sudo apt clean {{ update_accept_var }} &&
echo -e "\n" sudo dpkg --configure -a &&
typeset -l clean sudo apt --fix-broken --fix-missing install &&
if [[ "{{ update_accept_var }}" == "-y" || "$clean" == "y" ]]; then sudo apt dist-upgrade --allow-downgrades --fix-broken \
echo "Cleaning directory..." --fix-missing {{ update_accept_var }} ||
sudo sh -c "rm -rfv /var/db/freebsd-update; mkdir -v /var/db/freebsd-update" return 1
fi else
sudo freebsd-update fetch install echo "*** Parrot ***"
sudo apt update &&
sudo apt autoremove {{ update_accept_var }} &&
parrot_mirrors_suck=true &&
while [[ $parrot_mirrors_suck ]]; do
unset parrot_mirrors_suck
sudo parrot-upgrade
if [[ $? != 0 ]]; then
parrot_mirrors_suck=true
sudo apt update --fix-missing
fi
done ||
return 1
fi
;;
echo "*** Pkg ***" && pacman)
sudo pkg update && echo "*** Pacman ***"
sudo pkg clean {{ update_accept_var }} && if [[ "$accept" == "Y" ]]; then
sudo pkg autoremove {{ update_accept_var }} && auto_accept="{{ update_accept_var }}"
sudo pkg upgrade {{ update_accept_var }} && fi
when: ansible_pkg_mgr in ("pkg", "pkgng") sudo pacman -Syyu $auto_accept ||
return 1
;;
- name: General | Facts | Package | Update Commands | parrot-upgrade pkg | pkgng)
set_fact: echo "*** FreeBSD-Update ***"
update_package_manager: | clean=""
echo "*** Parrot ***" [[ "{{ update_accept_var }}" == "-y" ]] ||
sudo apt update && echo "Are you sure you'd like to clean /var/db/freebsd-update? [y/N] "
sudo apt autoremove {{ update_accept_var }} && [[ "{{ update_accept_var }}" == "-y" ]] ||
parrot_mirrors_suck=true && read -N 1 clean
while [[ $parrot_mirrors_suck ]]; do echo -e "\n"
unset parrot_mirrors_suck typeset -l clean
sudo parrot-upgrade if [[ "{{ update_accept_var }}" == "-y" || "$clean" == "y" ]]; then
if [[ $? != 0 ]]; then echo "Cleaning directory..."
parrot_mirrors_suck=true sudo sh -c "rm -rfv /var/db/freebsd-update
sudo apt update --fix-missing mkdir -v /var/db/freebsd-update"
fi fi
done && sudo freebsd-update fetch install
when: ansible_distribution == "Parrot OS"
- name: General | Facts | Package | Update Commands | dnf echo "*** Pkg ***" &&
set_fact: sudo pkg update &&
update_package_manager: | sudo pkg clean {{ update_accept_var }} &&
echo "*** DNF ***" && sudo pkg autoremove {{ update_accept_var }} &&
sudo dnf clean all {{ update_accept_var }} && sudo pkg upgrade {{ update_accept_var }} ||
sudo dnf autoremove {{ update_accept_var }} && return 1
sudo dnf upgrade {{ update_accept_var }} && ;;
when: ansible_pkg_mgr in ("dnf")
- name: General | Facts | Package | Update Commands | zypper dnf)
set_fact: echo "*** DNF ***" &&
update_package_manager: | sudo dnf clean all {{ update_accept_var }} &&
echo "*** Zypper ***" && sudo dnf autoremove {{ update_accept_var }} &&
sudo zypper refresh && sudo dnf upgrade {{ update_accept_var }} ||
sudo zypper cleanlocks && return 1
sudo zypper purge-kernels && ;;
sudo zypper clean -a &&
sudo zypper patch {{ update_accept_var }} &&
sudo zypper update {{ update_accept_var }} &&
sudo zypper dist-upgrade {{ update_accept_var }} &&
# This is a neat feature, but is installing things like GIMP from the
# repos when it is already installed through Flatpak, so not needed.
#sudo zypper install-new-recommends &&
when: ansible_pkg_mgr in ("zypper")
- name: General | Facts | Package | Update Commands | NixOS zypper)
set_fact: echo "*** Zypper ***" &&
update_package_manager: | sudo zypper refresh &&
sudo echo "*** NixOS ***" sudo zypper cleanlocks &&
# Clean up! sudo zypper purge-kernels &&
# https://specific.solutions.limited/blog/recovering-diskspace-in-nixos sudo zypper clean -a &&
sudo zypper patch {{ update_accept_var }} &&
sudo zypper update {{ update_accept_var }} &&
sudo zypper dist-upgrade {{ update_accept_var }} &&
# This is a neat feature, but is installing things like GIMP from the
# repos when it is already installed through Flatpak, so not needed.
#sudo zypper install-new-recommends ||
sleep 0 ||
return 1
;;
echo -en "\n * Delete any existing garbage and snapshots older than " *)
echo -e "{{ nix_days }} days.\n" if [[ $distribution == "NixOS" ]]; then
echo "User:" sudo echo "*** NixOS ***" &&
nix-collect-garbage --delete-older-than '{{ nix_days }}d' # Clean up!
echo "Root:" # https://specific.solutions.limited/blog/recovering-diskspace-in-nixos
sudo nix-collect-garbage --delete-older-than '{{ nix_days }}d'
ls ~/.cache/*nix* /root/.cache/*nix* 2>/dev/null 1>&2 && echo -en "\n * Delete any existing garbage and snapshots older than " &&
echo -e "\n * Delete any cache.\n" echo -e "{{ nix_days }} days.\n" &&
du -hs ~/.cache/*nix* 2>/dev/null && echo "User:" &&
echo "User:" && nix-collect-garbage --delete-older-than '{{ nix_days }}d' &&
rm -rfv ~/.cache/*nix* echo "Root:" &&
sudo du -hs /root/.cache/*nix* 2>/dev/null && sudo nix-collect-garbage --delete-older-than '{{ nix_days }}d'
echo "Root:" &&
sudo rm -rfv /root/.cache/*nix*
echo -e "\n * Update channels with the latest expressions.\n" ls ~/.cache/*nix* /root/.cache/*nix* 2>/dev/null 1>&2 &&
echo "User:" echo -e "\n * Delete any cache.\n"
nix-channel --update du -hs ~/.cache/*nix* 2>/dev/null &&
echo "Root:" echo "User:" &&
sudo nix-channel --update rm -rfv ~/.cache/*nix*
sudo du -hs /root/.cache/*nix* 2>/dev/null &&
echo "Root:" &&
sudo rm -rfv /root/.cache/*nix*
echo -e "\n * Rebuild using the existing *.nix files.\n" echo -e "\n * Update channels with the latest expressions.\n" &&
sudo nixos-rebuild switch echo "User:" &&
nix-channel --update &&
echo "Root:" &&
sudo nix-channel --update
echo -e "\n * Hard link duplicates, saves 25-35% of store size.\n" echo -e "\n * Rebuild using the existing *.nix files.\n" &&
sudo nix-store --optimize sudo nixos-rebuild switch ||
when: ansible_distribution == "NixOS" return 1
echo -e "\n * Hard link duplicates, saves 25-35% of store size.\n" &&
sudo nix-store --optimize
else
echo "WARNING: This package manager is not supported yet." >&2
echo " distribution='${distribution}', pkg_mgr='${pkg_mgr}'" >&2
fi
;;
esac &&
# End of update_package_manager
- name: General | Facts | Package | Update Commands | flatpak | check # Flatpaks
- name: General | Facts | Package | Update Command | Flatpak | Check
shell: which flatpak shell: which flatpak
register: flatpak_exec register: flatpak_exec
ignore_errors: yes ignore_errors: yes
- name: General | Facts | Package | Update Commands | flatpak | exists - name: General | Facts | Package | Update Command | Flatpak | Exists
set_fact: set_fact:
update_flatpak: | update_flatpak: |
echo "*** Flatpak ***" echo "*** Flatpak ***"
[[ {{ battery }} != 'True' ]] && sudo flatpak repair [[ -n {{ update_accept_var }} ]] && sudo flatpak repair
sudo flatpak uninstall --unused {{ update_accept_var }} && sudo flatpak uninstall --unused {{ update_accept_var }} &&
sudo flatpak update {{ update_accept_var }} && sudo flatpak update {{ update_accept_var }} ||
when: flatpak_exec is defined and flatpak_exec.failed is defined and not flatpak_exec.failed return 1
when: flatpak_exec is defined
and flatpak_exec.failed is defined
and not flatpak_exec.failed
- name: General | Facts | Package | Update Commands | flatpak | not exists - name: General | Facts | Package | Update Command | Flatpak | Missing
set_fact: set_fact:
update_flatpak: | update_flatpak: |
echo "*** Flatpak Not Installed ***" && echo "*** Flatpak Not Installed ***" &&
when: update_flatpak is not defined when: update_flatpak is not defined
# Firmware
- name: General | Facts | Package | Update Command | Firmware | Check
shell: which fwupdmgr
register: fwupdmgr_exec
ignore_errors: yes
- name: General | Facts | Package | Update Command | Firmware | Exists
set_fact:
update_firmware: |
echo "*** Firmware ***"
sudo fwupdmgr refresh --force &&
sudo fwupdmgr get-updates {{ update_accept_var }} &&
sudo fwupdmgr update --no-reboot-check {{ update_accept_var }} ||
return 1
when: fwupdmgr_exec is defined
and fwupdmgr_exec.failed is defined
and not fwupdmgr_exec.failed
- name: General | Facts | Package | Update Command | Firmware | Missing
set_fact:
update_firmware: |
echo "*** Firmware Updater (fwupdmgr) Not Installed ***" &&
when: update_firmware is not defined

View File

@ -21,7 +21,13 @@
set_fact: set_fact:
crond: cronie crond: cronie
crond_pattern: cronie crond_pattern: cronie
when: ansible_distribution == "Archlinux" when: ansible_distribution in ("Archlinux")
- name: General | Facts | Service | Fedora
set_fact:
crond: crond
crond_pattern: crond
when: ansible_distribution in ("Fedora")
- name: General | Facts | Service | Ubuntu Linux - name: General | Facts | Service | Ubuntu Linux
set_fact: set_fact:

View File

@ -89,6 +89,7 @@
firefox_esr: firefox firefox_esr: firefox
font_awesome: python3-XStatic-Font-Awesome font_awesome: python3-XStatic-Font-Awesome
nfs: nfs-utils nfs: nfs-utils
ffmpeg: ffmpeg-free
when: ansible_distribution == "Fedora" when: ansible_distribution == "Fedora"

216
files/scripts/compress_audio.sh Executable file
View File

@ -0,0 +1,216 @@
#!/bin/bash
# 2023-12-04 Hyperling
# Lower resolution of audio and convert to mp3. Also
# Also see: compress-video.sh
## Setup ##
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
PROG="$(basename -- "${BASH_SOURCE[0]}")"
echo "Running '$DIR/$PROG'."
# Integers
typeset -i status
# Strings
typeset -l quality
quality="256k"
mp3="mp3"
tag="shrunk"
date_YYYYMMDD="`date "+%Y%m%d"`"
location="."
search="ls"
large_extension="DoNotUse-LargerThanOriginal"
large_created=".$PROG.large_created.true"
## Functions ##
function usage() {
# Hit the user with knowledge on how to use this program.
# Parameters:
# 1) The exit status to use.
status=$1
echo -n "Usage: $PROG [-q QUALITY] [-l LOCATION] " >&2
echo "[-A | [-r] [-f] [-d] [-c] [-z]] [-h] [-x]" >&2
cat <<- EOF
Compress audio to mp3. Can handle folders and work recursively.
Parameters:
-q QUALITY : Integer for the maximum length of either media dimension.
-l LOCATION : The specific media or folder which needs compressed.
-r : Recursively shrink media based on the location passed.
-f : Force the media to be shrunk even if a file already exists for it.
-d : Delete the original media if the compressed media is smaller.
-c : Clean the filename of underscores, dashes, 'IMG', etc.
-z : Convert from 440 to 432 Hz
-A : Resursively Force, Delete, and Clean.
-h : Display this usage text.
-x : Enable BASH debugging.
EOF
exit $status
}
## Parameters ##
while getopts ":q:l:rfdczAhx" opt; do
case $opt in
q) quality="$OPTARG" ;;
l) location="$OPTARG" ;;
r) recurse="Y" && search="find" ;;
f) force="Y" ;;
d) delete="Y" ;;
c) clean="Y" ;;
z) frequency="Y" ;;
A) recurse="Y" &&
search="find" &&
force="Y" &&
delete="Y" &&
clean="Y" &&
frequency="Y" ;;
h) usage 0 ;;
x) set -x ;;
*) echo "ERROR: Option $OPTARG not recognized." >&2 && usage 1 ;;
esac
done
## Validations ##
convert_exe="`which ffmpeg`"
if [[ "$convert_exe" == "" ]]; then
echo "ERROR: 'ffmpeg' command could not be found, "
echo "please install 'ffmpeg'."
usage 2
fi
## Main ##
# If using ls, make sure full path is passed to the loop by adding '/*'.
if [[ -z "$recurse" && -d "$location" && "$location" != *'/*' ]]; then
if [[ "$location" != *'/' ]]; then
location="${location}/"
fi
fi
settings="-ab $quality"
if [[ $frequency == "Y" ]]; then
settings="$settings -af asetrate=44100*432/440,aresample=44100,atempo=440/432"
fi
$search "$location" | sort | while read media; do
# Avoid processing directories no matter the name.
[ -d "$media" ] && continue
# Avoid processing files previously shrunk.
[[ "$media" == *"$tag"* ]] && continue
echo -e "\n$media"
# Only look through mp3, m4a, flac, wav for now.
typeset -l extension
extension="${media##*.}"
if [[ "$extension" != *"mp3"
&& "$extension" != *"m4a"
&& "$extension" != *"flac"
&& "$extension" != *"wav" ]]
then
echo " SKIP: Sorry, currently only mp3, m4a, flac, and wav are supported."
continue
fi
new_media="${media//.$extension/}.$tag-$date_YYYYMMDD.$mp3"
# Clean the filename of extra junk so that they can be chronological order.
new_media_clean="$new_media"
new_media_clean="${new_media_clean//_/ }"
###new_media_clean="${new_media_clean//-/}"
# Delete the existing shrunk media if we are forcing a new compression.
if [[ -n "$force" && (-e "$new_media" || -e "$new_media_clean") ]]; then
echo -n " FORCE: "
rm -v "$new_media" "$new_media_clean" 2>/dev/null
fi
# Skip if a compressed media was already created today.
if [[ -e "$new_media" || -e "$new_media_clean" ]]; then
echo " SKIP: Media has already been shrunk previously, moving on."
continue
fi
# Whether or not to use the cleaned version or the normal version.
if [[ -n "$clean" ]]; then
new_media="$new_media_clean"
fi
### TBD Instead of this, only alter the file names, and set a dirname var?
# Create a new directory if the directory names were altered.
mkdir -pv "`dirname "$new_media"`"
# This modifies the media to be $size at its longest end, not be a square.
$convert_exe -nostdin -hide_banner -loglevel quiet \
-i "$media" $settings "$new_media"
status="$?"
if [[ "$status" != 0 ]]; then
echo " SKIP: '$convert_exe' returned a status of '$status'."
continue
fi
# Check file sizes and if the new one is larger then flag it as large.
echo " Checking file sizes:"
ls -sh "$media" "$new_media" | sort -hr | while read line; do
echo " $line"
done
smaller_file=`
ls -sh "$media" "$new_media" | sort -h | cut -f 2- -d ' ' | head -n 1
`
if [[ "$smaller_file" == "$media" ]]; then
echo -n " WARNING: Conversion caused growth, original was likely lesser "
echo "quality. Adding a suffix to the file to signify that it may be bad."
echo -n " "
mv -v "$new_media" "$new_media.$large_extension"
touch "$large_created"
continue
fi
if [[ -e "$new_media" ]]; then
echo " SUCCESS: Conversion succeeded, file has been compressed."
else
echo " ERROR: New media '$new_media' could not be found. Aborting."
break;
fi
if [[ -n "$delete" ]]; then
echo -n " DELETE: "
if [[ -d ~/TRASH ]]; then
mv -v "$media" ~/TRASH/
else
rm -v "$media"
fi
fi
done
# If large files do end up being created, allow the user to bulk delete them.
if [[ -e "$large_created" ]]; then
echo -e "\n*********************************************************"
echo -e "WARNING: The files below are larger than their originals!\n"
find "$location" -name "*"$large_extension
echo -e "*********************************************************"
echo -en "\nWould you like to delete them? (Y/n): "
typeset -u confirm_delete
read confirm_delete
if [[ -z "$confirm_delete" || "$confirm_delete" == "Y"* ]]; then
echo ""
find "$location" -name "*"$large_extension -exec rm -v {} \;
else
echo -e "\nKeeping files. Please use this if you change your mind:"
echo " find \"$location\" -name \"*\"$large_extension -exec rm -v {} \;"
fi
rm "$large_created"
fi
echo -e "\nDone!"
exit 0

View File

@ -28,7 +28,7 @@ function usage() {
# Parameters: # Parameters:
# 1) The exit status to use. # 1) The exit status to use.
status=$1 status=$1
echo "Usage: $PROG [-s SIZE] [-l LOCATION] [-r] [-f] [-d] [-c] [-h] [-x]" >&2 echo "Usage: $PROG [-s SIZE] [-l LOCATION] [-A | [-r] [-f] [-d] [-c]] [-h] [-x]" >&2
cat <<- EOF cat <<- EOF
Compress JPG or PNG image(s). Can handle folders and work recursively. Compress JPG or PNG image(s). Can handle folders and work recursively.
@ -39,6 +39,7 @@ function usage() {
-f : Force the image to be shrunk even if a file already exists for it. -f : Force the image to be shrunk even if a file already exists for it.
-d : Delete the original image if the compressed image is smaller. -d : Delete the original image if the compressed image is smaller.
-c : Clean the filename of underscores, dashes, 'IMG', etc. -c : Clean the filename of underscores, dashes, 'IMG', etc.
-A : Resursively Force, Delete, and Clean.
-h : Display this usage text. -h : Display this usage text.
-x : Enable BASH debugging. -x : Enable BASH debugging.
EOF EOF
@ -47,7 +48,7 @@ function usage() {
## Parameters ## ## Parameters ##
while getopts ":s:l:rfdchx" opt; do while getopts ":s:l:rfdcAhx" opt; do
case $opt in case $opt in
s) in_size="$OPTARG" && size="$in_size" ;; s) in_size="$OPTARG" && size="$in_size" ;;
l) location="$OPTARG" ;; l) location="$OPTARG" ;;
@ -55,6 +56,7 @@ while getopts ":s:l:rfdchx" opt; do
f) force="Y" ;; f) force="Y" ;;
d) delete="Y" ;; d) delete="Y" ;;
c) clean="Y" ;; c) clean="Y" ;;
A) recurse="Y" && search="find" && force="Y" && delete="Y" && clean="Y" ;;
h) usage 0 ;; h) usage 0 ;;
x) set -x ;; x) set -x ;;
*) echo "ERROR: Option $OPTARG not recognized." >&2 && usage 1 ;; *) echo "ERROR: Option $OPTARG not recognized." >&2 && usage 1 ;;
@ -147,7 +149,7 @@ $search "$location" | sort | while read image; do
echo " $line" echo " $line"
done done
smaller_file=` smaller_file=`
ls -sh "$image" "$new_image" | sort -h | awk '{print $2}' | head -n 1 ls -sh "$image" "$new_image" | sort -h | cut -f 2- -d ' ' | head -n 1
` `
if [[ "$smaller_file" == "$image" ]]; then if [[ "$smaller_file" == "$image" ]]; then
echo -n " WARNING: Conversion caused growth, original was likely lesser " echo -n " WARNING: Conversion caused growth, original was likely lesser "

View File

@ -175,7 +175,7 @@ $search_command "$input" | sort | while read file; do
# Check the filesize compared to the original and note if it is larger. # Check the filesize compared to the original and note if it is larger.
echo "Checking file sizes:" echo "Checking file sizes:"
ls -sh "$file" "$newfile" | sort -hr ls -sh "$file" "$newfile" | sort -hr
smaller_file=`ls -sh "$file" "$newfile" | sort -h | awk '{print $2}' | head -n 1` smaller_file=`ls -sh "$file" "$newfile" | sort -h | cut -f 2- -d ' ' | head -n 1`
if [[ "$smaller_file" == "$file" ]]; then if [[ "$smaller_file" == "$file" ]]; then
echo -n "Conversion had the opposite effect, original was likely lesser " echo -n "Conversion had the opposite effect, original was likely lesser "
echo "quality. Adding a suffix to the file to signify that it grew." echo "quality. Adding a suffix to the file to signify that it grew."

View File

@ -0,0 +1,9 @@
[Profile0]
Name=haxor
IsRelative=1
Path=l33t.haxor
Default=1
[General]
StartWithLastProfile=1
Version=2

View File

@ -0,0 +1,14 @@
// Needs saved as:
// ~/.var/app/com.visualstudio.code-oss/config/Code - OSS/{{ user_desc }}/settings.json
// ~/.var/app/com.vscodium.codium/config/VSCodium/{{ user_desc }}/settings.json
{
"workbench.startupEditor": "none",
"editor.rulers": [
80, 120, 200
],
"files.trimTrailingWhitespace": true,
"editor.tabSize": 3,
"editor.insertSpaces": false,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true
}

View File

@ -121,15 +121,18 @@
- include_tasks: tasks/workstation/shared/software/dwm.yml - include_tasks: tasks/workstation/shared/software/dwm.yml
# Software Tasks # # Software Tasks #
- include_tasks: tasks/workstation/linux/software/flatpaks.yml
when: ansible_system == "Linux" and flatpak_distro
- include_tasks: tasks/workstation/linux/software/packages.yml - include_tasks: tasks/workstation/linux/software/packages.yml
when: ansible_system == "Linux" when: ansible_system == "Linux"
- include_tasks: tasks/workstation/linux/software/flatpaks.yml
when: ansible_system == "Linux" and flatpak_distro
- include_tasks: tasks/workstation/linux/software/brave.yml - include_tasks: tasks/workstation/linux/software/brave.yml
when: ansible_pkg_mgr in ("apt", "dnf", "zypper") and not mobile when: ansible_pkg_mgr in ("apt", "dnf", "zypper") and not mobile
- include_tasks: tasks/workstation/linux/software/vpn.yml
when: ansible_system == "Linux"
- include_tasks: tasks/workstation/freebsd/software/packages.yml - include_tasks: tasks/workstation/freebsd/software/packages.yml
when: ansible_system == "FreeBSD" when: ansible_system == "FreeBSD"

View File

@ -10,3 +10,4 @@
- sudo - sudo
- video - video
- render - render
- wheel

View File

@ -66,6 +66,7 @@
- sudo - sudo
- video - video
- render - render
- wheel
append: yes append: yes
shell: "{{ user_shell }}" shell: "{{ user_shell }}"
create_home: yes create_home: yes
@ -170,10 +171,34 @@
{{ update_package_manager }} {{ update_package_manager }}
{{ update_flatpak }} {{ update_flatpak }}
echo "*** Completed Successfully ***"
return 0 return 0
}
function_update_firmware: |
function update-firmware() {
PROG=$FUNCNAME
usage="Usage: $PROG [-y]
$PROG is used to run the firmware updater in one swoop. Flow stops if
any command returns a failure code. The hope is to run something as
easy as 'pacman -Syyu' but for non-Arch systems.
-y : Assume yes to any prompts."
echo "ERROR: $PROG experienced a problem and has aborted." >&2 unset OPTIND
return 1 unset accept
while getopts ":hy" opt; do
case $opt in
h) echo -e "$usage"
return 0 ;;
y) accept="-y" ;;
*) echo "ERROR: -$OPTARG is not a recognized option." >&2
echo -e "$usage"
return 1 ;;
esac
done
{{ update_firmware }}
echo "*** Completed Successfully ***"
return 0
} }
alias_sync: alias sync='date && echo "Syncing!" && sync && date' alias_sync: alias sync='date && echo "Syncing!" && sync && date'
export_editor: export EDITOR='vi' export_editor: export EDITOR='vi'
@ -388,6 +413,8 @@
--branch dev ~/Code/ansible-dev --branch dev ~/Code/ansible-dev
git clone git@github.com:Hyperling/Docker \ git clone git@github.com:Hyperling/Docker \
--branch dev ~/Code/docker-dev --branch dev ~/Code/docker-dev
git clone git@github.com:Hyperling/Website \
--branch dev ~/Code/website-dev
git clone git@github.com:Hyperling/NixOS \ git clone git@github.com:Hyperling/NixOS \
--branch dev ~/Code/nixos-dev --branch dev ~/Code/nixos-dev
git clone git@github.com:Hyperling/BreakTheHabit \ git clone git@github.com:Hyperling/BreakTheHabit \
@ -422,6 +449,8 @@
done done
echo -e "\nDone!\n" echo -e "\nDone!\n"
} }
alias_clone: |
alias clone="rsync -auPh --delete"
- name: General | Account Management | Users | Files | Common Variable - name: General | Account Management | Users | Files | Common Variable
set_fact: set_fact:
@ -436,6 +465,7 @@
{{ export_PS1 }} {{ export_PS1 }}
{{ alias_remount }} {{ alias_remount }}
{{ function_update }} {{ function_update }}
{{ function_update_firmware }}
{{ alias_sync }} {{ alias_sync }}
{{ export_editor }} {{ export_editor }}
{{ init_aliases }} {{ init_aliases }}
@ -458,6 +488,7 @@
{{ alias_code_reseed }} {{ alias_code_reseed }}
{{ function_clean_filenames }} {{ function_clean_filenames }}
{{ function_clean_filenames_tree }} {{ function_clean_filenames_tree }}
{{ alias_clone }}
- name: General | Account Management | Users | Files | .bashrc - name: General | Account Management | Users | Files | .bashrc
blockinfile: blockinfile:

View File

@ -1,12 +1,17 @@
--- ---
# Install Metasploit Framework # Install Metasploit Framework
- name: General | Software | Metasploit | Facts
set_fact:
metasploit_installer: msfinstall
when: ansible_system in ("Linux", "Darwin")
- name: General | Software | Metasploit | Install - name: General | Software | Metasploit | Install
shell: "{{ item }}" shell: "{{ item }}"
loop: loop:
- curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall - "curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > {{ metasploit_installer }}"
- chmod 755 msfinstall - "chmod 755 {{ metasploit_installer }}"
- mkdir -p /usr/local/bin/ - "mkdir -p {{ global_bin }}"
- mv ./msfinstall /usr/local/bin/msfinstall - "mv ./msfinstall {{ global_bin }}/{{ metasploit_installer }}"
- msfinstall - "{{ global_bin }}/{{ metasploit_installer }}"
when: ansible_system in ("Linux", "Darwin") when: ansible_system in ("Linux", "Darwin")

View File

@ -3,7 +3,7 @@
- name: General | Tests | Lynis | Set Facts - name: General | Tests | Lynis | Set Facts
set_fact: set_fact:
lynis_file: "{{ user_user.home }}/Reports/{{ lynis_report }}" lynis_file: "{{ user_user.home }}/Reports/{{ ansible_hostname }}.{{ lynis_report }}"
- name: General | Tests | Lynis | Set Facts 2 - name: General | Tests | Lynis | Set Facts 2
set_fact: set_fact:

View File

@ -3,7 +3,7 @@
- name: General | Tests | nmap | Set Facts - name: General | Tests | nmap | Set Facts
set_fact: set_fact:
nmap_file: "{{ user_user.home }}/Reports/{{ nmap_report }}" nmap_file: "{{ user_user.home }}/Reports/{{ ansible_hostname }}.{{ nmap_report }}"
nmap_separator: "\n*******************************\n" nmap_separator: "\n*******************************\n"
- name: General | Tests | nmap | Set Facts 2 - name: General | Tests | nmap | Set Facts 2

View File

@ -3,8 +3,8 @@
- name: General | Tests | Services | Set Facts - name: General | Tests | Services | Set Facts
set_fact: set_fact:
services_report_file: "{{ user_user.home }}/Reports/services.txt" services_report_file: "{{ user_user.home }}/Reports/{{ ansible_hostname }}.services.txt"
services_enabled_file: "{{ user_user.home }}/Reports/services-enabled.txt" services_enabled_file: "{{ user_user.home }}/Reports/{{ ansible_hostname }}.services-enabled.txt"
services_command: "systemctl list-unit-files" services_command: "systemctl list-unit-files"
- name: General | Tests | Services | Create Main Report - name: General | Tests | Services | Create Main Report

View File

@ -37,7 +37,6 @@
flatpaks_generic: flatpaks_generic:
- { app: "org.libreoffice.LibreOffice", name: "office", extra: "" } - { app: "org.libreoffice.LibreOffice", name: "office", extra: "" }
- { app: "io.gitlab.librewolf-community", name: "librewolf", extra: "" } - { app: "io.gitlab.librewolf-community", name: "librewolf", extra: "" }
- { app: "chat.delta.desktop", name: "deltachat", extra: "" }
- { app: "org.signal.Signal", name: "signal", extra: "" } - { app: "org.signal.Signal", name: "signal", extra: "" }
- { app: "org.mozilla.firefox", name: "firefox-flatpak", extra: "" } - { app: "org.mozilla.firefox", name: "firefox-flatpak", extra: "" }
- { app: "com.transmissionbt.Transmission", name: "transmission", extra: "" } - { app: "com.transmissionbt.Transmission", name: "transmission", extra: "" }
@ -71,6 +70,7 @@
- { app: "com.jetbrains.PyCharm-Community", name: "pycharm", extra: "" } - { app: "com.jetbrains.PyCharm-Community", name: "pycharm", extra: "" }
# End 2022-11-20 # # End 2022-11-20 #
- { app: "io.lbry.lbry-app", name: "lbry", extra: "dbus-launch" } # No longer supported, noticed 2023-09-01. - { app: "io.lbry.lbry-app", name: "lbry", extra: "dbus-launch" } # No longer supported, noticed 2023-09-01.
- { app: "chat.delta.desktop", name: "deltachat", extra: "" } # No longer used, removed 2023-12-18.
# Generic # # Generic #
@ -268,74 +268,3 @@
state: absent state: absent
loop: "{{ flatpaks_remove }}" loop: "{{ flatpaks_remove }}"
ignore_errors: yes ignore_errors: yes
## Other Stuff ##
# Software not yet available or working properly in Flatpak form.
- name: Workstation | Linux | Flatpak Distro | Package Manager | Install From Repo
package:
name:
- "{{ firefox_esr }}"
- vlc
- "{{ appimagelauncher }}"
- "{{ evolution }}"
- "{{ evolution }}*"
state: present
- name: Workstation | Linux | Flatpak Distro | Package Manager | Remove Firefox Normal
package:
name:
- "{{ firefox }}"
state: absent
when: firefox != firefox_esr
# Lutris #
- name: Workstation | Linux | Flatpak Distro | Package Manager | Add Lutris PPA (Ubuntu)
apt_repository:
repo: ppa:lutris-team/lutris
update_cache: yes
state: present
when: ansible_distribution == "Ubuntu" and gaming == true
ignore_errors: yes
- name: Workstation | Linux | Flatpak Distro | Package Manager | Add Lutris (besides ARM)
package:
name:
- lutris
state: present
when: ansible_architecture != "aarch64" and gaming == true
ignore_errors: yes
- name: Workstation | Linux | Flatpak Distro | Package Manager | Remove Lutris (besides ARM)
package:
name:
- lutris
state: absent
when: ansible_architecture != "aarch64" and gaming is not defined
ignore_errors: yes
- name: Workstation | Linux | Flatpak Distro | Package Manager | Remove Lutris PPA (Ubuntu)
apt_repository:
repo: ppa:lutris-team/lutris
update_cache: yes
state: absent
when: ansible_distribution == "Ubuntu" and gaming is not defined
ignore_errors: yes
# Remove Repo Software #
- name: Workstation | Linux | Flatpak Distro | Package Manager | Remove Applications
package:
name:
- "{{ thunderbird }}"
- steam
- vscode
- code
- libreoffice
- "*libreoffice*"
- '*libreoffice*'
- gimp
state: absent

View File

@ -1,9 +1,92 @@
--- ---
# Packages specific to workstations. # Packages specific to workstations.
- name: Workstation | Software | Packages | Install Software (Editing) ## Repo Management ##
# Needed for dnf packages such as vlc.
# https://docs.fedoraproject.org/en-US/quick-docs/rpmfusion-setup/
- name: Workstation | Linux | Software | Packages | Fedora Fusion Repos
shell: "{{ item }}"
loop:
- "dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm"
- "dnf config-manager --enable rpmfusion-free"
- "dnf config-manager --enable rpmfusion-free-updates"
- "dnf install -y https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm"
- "dnf config-manager --enable rpmfusion-nonfree"
- "dnf config-manager --enable rpmfusion-nonfree-updates"
when: ansible_distribution == "Fedora"
## Packages ##
- name: Workstation | Linux | Software | Packages | Install Software (Editing)
package: package:
name: name:
- "{{ ffmpeg }}" - "{{ ffmpeg }}"
state: present state: present
when: editing == true when: editing == true
## Other Stuff
# Software not yet available or working properly in Flatpak form.
- name: Workstation | Linux | Software | Packages | Install From Repo
package:
name:
- vlc
- "{{ appimagelauncher }}"
- "{{ evolution }}"
- "{{ evolution }}*"
state: present
# Lutris #
- name: Workstation | Linux | Software | Packages | Add Lutris PPA (Ubuntu)
apt_repository:
repo: ppa:lutris-team/lutris
update_cache: yes
state: present
when: ansible_distribution == "Ubuntu" and gaming == true
ignore_errors: yes
- name: Workstation | Linux | Software | Packages | Add Lutris (besides ARM)
package:
name:
- lutris
state: present
when: ansible_architecture != "aarch64" and gaming == true
ignore_errors: yes
- name: Workstation | Linux | Software | Packages | Remove Lutris (besides ARM)
package:
name:
- lutris
state: absent
when: ansible_architecture != "aarch64" and gaming is not defined
ignore_errors: yes
- name: Workstation | Linux | Software | Packages | Remove Lutris PPA (Ubuntu)
apt_repository:
repo: ppa:lutris-team/lutris
update_cache: yes
state: absent
when: ansible_distribution == "Ubuntu" and gaming is not defined
ignore_errors: yes
# Remove Repo Software #
- name: Workstation | Linux | Software | Packages | Remove Applications
package:
name:
- "{{ firefox }}"
- "{{ firefox_esr }}"
- "{{ thunderbird }}"
- steam
- vscode
- code
- libreoffice
- "*libreoffice*"
- '*libreoffice*'
- gimp
state: absent

View File

@ -0,0 +1,23 @@
---
# Install VPN client(s).
# https://mullvad.net/en/help/install-mullvad-app-linux
- name: Workstation | Software | VPN | Add Mullvad Repo [apt]
shell: "{{ item }}"
loop:
- sudo curl -fsSLo /usr/share/keyrings/mullvad-keyring.asc https://repository.mullvad.net/deb/mullvad-keyring.asc
- echo "deb [signed-by=/usr/share/keyrings/mullvad-keyring.asc arch=$( dpkg --print-architecture )] https://repository.mullvad.net/deb/stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/mullvad.list
- apt update
when: ansible_pkg_mgr == "apt"
- name: Workstation | Software | VPN | Add Mullvad Repo [dnf]
shell: "{{ item }}"
loop:
- sudo dnf config-manager --add-repo https://repository.mullvad.net/rpm/stable/mullvad.repo
when: ansible_pkg_mgr == "dnf"
- name: Workstation | Software | VPN | Install
package:
name:
- mullvad-vpn
state: present

View File

@ -1,6 +1,8 @@
--- ---
# GNOME settings, extensions, and setup. # GNOME settings, extensions, and setup.
# Temporarily removed while it's broken:
# , 'com.vscodium.codium.desktop', 'codium.desktop'
- name: Workstation | Account Management | GNOME | Facts - name: Workstation | Account Management | GNOME | Facts
set_fact: set_fact:
# Only do multiple entries per line if they are for the same exact program. # Only do multiple entries per line if they are for the same exact program.
@ -14,7 +16,6 @@
, 'chat.delta.desktop.desktop', 'deltachat.desktop' , 'chat.delta.desktop.desktop', 'deltachat.desktop'
, 'org.gnome.Geary.desktop' , 'org.gnome.Geary.desktop'
, 'org.mozilla.Thunderbird.desktop' , 'org.mozilla.Thunderbird.desktop'
, 'com.vscodium.codium.desktop', 'codium.desktop'
, 'com.visualstudio.code-oss.desktop', 'code-oss.desktop' , 'com.visualstudio.code-oss.desktop', 'code-oss.desktop'
, 'org.godotengine.Godot.desktop' , 'org.godotengine.Godot.desktop'
, 'org.shotcut.Shotcut.desktop' , 'org.shotcut.Shotcut.desktop'
@ -152,145 +153,12 @@
become_user: "{{ user }}" become_user: "{{ user }}"
when: ansible_distribution not in ("Ubuntu") and dash_to_dock_exists.failed when: ansible_distribution not in ("Ubuntu") and dash_to_dock_exists.failed
# Settings #
- name: Workstation | Account Management | GNOME | Dash To Dock | Dock Position
dconf:
key: /org/gnome/shell/extensions/dash-to-dock/dock-position
value: "'LEFT'"
state: present
become_user: "{{ user }}"
- name: Workstation | Account Management | GNOME | Dash To Dock | Dock Fixed
dconf:
key: /org/gnome/shell/extensions/dash-to-dock/dock-fixed
value: "true"
state: present
become_user: "{{ user }}"
- name: Workstation | Account Management | GNOME | Dash To Dock | Icon Size
dconf:
key: /org/gnome/shell/extensions/dash-to-dock/dash-max-icon-size
value: "28"
state: present
become_user: "{{ user }}"
when: ansible_distribution not in ("NixOS") when: ansible_distribution not in ("NixOS")
ignore_errors: yes ignore_errors: yes
# End block for Dash To Dock. # End block for Dash To Dock.
## TBD Remove this after testing the RC version is successful on Ubuntu. # Apply dconf settings through RC files due to distros without working psutil.
#- name: Workstation | Account Management | GNOME | More Settings - name: Workstation | Account Management | GNOME | Settings
# block:
#
# - name: Workstation | Account Management | GNOME + Cinnamon | Favorites (Linux)
# dconf:
# key: "{{ item }}"
# value: "{{ gnome_favorites }}"
# state: present
# become_user: "{{ user }}"
# #when: ansible_system == "Linux"
# loop:
# - /org/gnome/shell/favorite-apps
# # - /org/cinnamon/favorite-apps
# # As of 2023-07-01 this only sets the Menu Favorites on Cinnamon, not the
# # Panel Pins. Cannot find any details online of where the pinned application
# # data lives. Cloned and searched the linuxmint/cinnamon project too and
# # couldn't find which function handles it. Leaving the loop for it but it's
# # not what was hoped for and is sort of a TBD/TODO.
#
# ## This is now handled by the task above, it's OK to have values not found.
# #- name: Workstation | Account Management | GNOME | Favorites (FreeBSD)
# # dconf:
# # key: /org/gnome/shell/favorite-apps
# # value: "['org.gnome.Terminal.desktop', 'org.gnome.Nautilus.desktop',
# # 'firefox.desktop', 'org.gnome.Evolution.desktop', 'org.mozilla.Thunderbird.desktop',
# # 'code-oss.desktop', 'org.telegram.desktop.desktop']"
# # state: present
# # become_user: "{{ user }}"
# # when: ansible_system == "FreeBSD"
#
#
# ## Top Bar Settings ##
# # (Battery Percentage, Clock Weekday+Seconds, Calendar Week Numbers)
#
# - name: Workstation | Account Management | GNOME | Interface - Show Date
# dconf:
# key: /org/gnome/desktop/interface/clock-show-date
# value: "true"
# state: present
# become_user: "{{ user }}"
#
# - name: Workstation | Account Management | GNOME | Interface - 24h Format
# dconf:
# key: /org/gnome/desktop/interface/clock-format
# value: "'24h'"
# state: present
# become_user: "{{ user }}"
#
# - name: Workstation | Account Management | GNOME | Interface - Show Seconds
# dconf:
# key: /org/gnome/desktop/interface/clock-show-seconds
# value: "true"
# state: present
# become_user: "{{ user }}"
#
# - name: Workstation | Account Management | GNOME | Interface - Show Weekday
# dconf:
# key: /org/gnome/desktop/interface/clock-show-weekday
# value: "true"
# state: present
# become_user: "{{ user }}"
#
# - name: Workstation | Account Management | GNOME | Interface - 24h Format
# dconf:
# key: /org/gnome/desktop/interface/show-battery-percentage
# value: "true"
# state: present
# become_user: "{{ user }}"
#
# - name: Workstation | Account Management | GNOME | Interface - Show Week Date
# dconf:
# key: /org/gnome/desktop/calendar/show-weekdate
# value: "true"
# state: present
# become_user: "{{ user }}"
#
# ## TBD These are done for NixOS in the section below. ##
# # Never Prompt for Removal Media
#
# # Dark theme?
# #Pop-dark on Pop
# #Adwaita-dark on everything else
#
# # Window Titlebars (Titlebar Buttons Minimize)
# - name: Workstation | Account Management | GNOME | Window Buttons
# dconf:
# key: /org/gnome/desktop/wm/preferences/button-layout
# value: "'appmenu:minimize,close'"
# state: present
# become_user: "{{ user }}"
#
#
# # Security
# - name: Workstation | Account Management | GNOME | Privacy - Camera
# dconf:
# key: /org/gnome/desktop/privacy/disable-camera
# value: "true"
# state: present
# become_user: "{{ user }}"
#
# - name: Workstation | Account Management | GNOME | Privacy - Microphone
# dconf:
# key: /org/gnome/desktop/privacy/disable-microphone
# value: "true"
# state: present
# become_user: "{{ user }}"
#
# when: ansible_distribution not in ("NixOS")
## NixOS support, in an odd but working fashion for now. :)
- name: Workstation | Account Management | GNOME | Dash To Dock | NixOS
blockinfile: blockinfile:
path: "{{ user_user.home }}/{{ item }}" path: "{{ user_user.home }}/{{ item }}"
block: | block: |
@ -383,6 +251,7 @@
dconf write /org/gnome/desktop/screensaver/lock-delay "uint32 0" && inc_dconf && dconf write /org/gnome/desktop/screensaver/lock-delay "uint32 0" && inc_dconf &&
dconf write /org/gnome/desktop/session/idle-delay "uint32 900" && inc_dconf && dconf write /org/gnome/desktop/session/idle-delay "uint32 900" && inc_dconf &&
dconf write /org/gnome/settings-daemon/plugins/power/sleep-inactive-ac-type "'nothing'" && inc_dconf && dconf write /org/gnome/settings-daemon/plugins/power/sleep-inactive-ac-type "'nothing'" && inc_dconf &&
dconf write /org/gnome/settings-daemon/plugins/power/power-button-action "'nothing'" && inc_dconf &&
dconf write /org/gnome/desktop/media-handling/autorun-never true && inc_dconf && dconf write /org/gnome/desktop/media-handling/autorun-never true && inc_dconf &&
@ -406,4 +275,3 @@
loop: loop:
- .bashrc - .bashrc
- .zshrc - .zshrc
#when: ansible_distribution in ("NixOS")