diff --git a/README.md b/README.md index cfc4493..917afad 100755 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ Miscellaneous scripts, e.g. set screen brightness from command line (bug workaro ## Other * Backup and restore scripts for packages installed on Solus OS * Set up a Solus OS development environment (update needed) -* git_tidy_local_branches.sh - will remove local branches when the remote is gone # new saved * Backup and restore scripts for Linux systems * obsidian_hide_inlineTitle.py - Change all Obsidian vaults to hide inline titles * obsidian_get_inlineTitle_values.py - Get the value of inlineTitle in all Obsidian vaults diff --git a/file_processing/archive_taxes.pl b/file_processing/archive_taxes.pl index 745ad9b..2c5ca81 100755 --- a/file_processing/archive_taxes.pl +++ b/file_processing/archive_taxes.pl @@ -7,24 +7,20 @@ use File::Find::Rule; # find all the subdirectories of a given directory use File::Path qw(make_path remove_tree); use File::Copy; -## Need to look at this and see what its doing -# These days can just archive taxes for last year during this year -# ex archive 2023 taxes if running in 2024 -# Also think this is doing double work with archive_statements - my $now = localtime; my $year = $now->year; +print "Year is $year\n"; # Get year to archive from current year my $lastyear = $now->add_years(-1)->year; my $lasttaxyear = $now->add_years(-2)->year; -print("Processing taxes for year $lastyear\n"); +print("Last year was $lastyear and tax year was $lasttaxyear\n"); # Define and create folders my ( $financial_folder, $financial_archive_folder, $lastyear_folder, $lasttaxyear_folder ); $financial_folder = '/home/tracey/Documents/financial/current_year/'; -$financial_archive_folder = '/home/tracey/Documents/financial/1_financial_archives/'; +$financial_archive_folder = '/home//Documents/financial/1_financial_archives/'; $lastyear_folder = $financial_archive_folder . $lastyear . 'FinancialArchives'; $lasttaxyear_folder = $financial_archive_folder . $lasttaxyear . 'TaxArchives'; my @folders = ( $financial_folder, $financial_archive_folder, $lastyear_folder, $lasttaxyear_folder ); diff --git a/kde_dev/README.md b/kde_dev/README.md deleted file mode 100755 index ce5e1cd..0000000 --- a/kde_dev/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Utility scripts for KDE development - -## get_branches_for_dirs - -Gets the branch checked out for each directory under $HOME/kde/src -Prints a list of directories that don't have master checked out, with the branch \ No newline at end of file diff --git a/kde_dev/build_multiple.sh b/kde_dev/build_multiple.sh deleted file mode 100755 index a3ad6a7..0000000 --- a/kde_dev/build_multiple.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash -# Build multiple projects based on a provided list - -current_date=$(date -I) -src_dir=$HOME/kde/src -dirs='' - -# Function to display script usage UPDATE -usage () { - echo "Usage: $0" - echo "./$(basename "$0") [-h] [-d]" - echo "" - echo " -h, --help Display this help message" - echo " -d The list of directories to build" - echo "" - echo "This script takes a quoted list of directories. ex:" - echo "" - echo ' build_multiple "breeze libplasma plasma-desktop"' - echo "" - echo 'In each directory, this will pull the branch and build the project' -} - -# list of arguments expected in the input -optstring=":d:h" - -while getopts ${optstring} option; do - case "${option}" in - d) dirs="${OPTARG}" ;; - h) usage - exit 0 ;; - *) usage - exit 1 ;; - ?) - echo "Invalid option: -${OPTARG}." >&2 - echo usage >&2 - exit 1 - ;; - esac -done - -update_and_build_dir () { - cd ${src_dir} - echo `pwd` - cd ${dir} - echo `pwd` - git fetch || { echo 'git fetch failed' ; exit 1; } - git pull || { echo 'git pull failed' ; exit 1; } - kde-builder $(basename "$PWD") --no-src --resume-from $(basename "$PWD") || { echo "kde-builder failed for $PWD" ; exit 1; } -} - -if [[ ( $@ == "--help") || $@ == "-h" ]]; then - usage - exit 0 -fi - -printf "Building requested projects\n%s ${dirs}\n" - -# Split the string of directories into an array -read -r -a splitArray <<<"$dirs" - -for dir in "${splitArray[@]}"; -do - echo "dir passing to sub is ${dir}" - update_and_build_dir "${dir}" -done - -echo "Builds done" diff --git a/kde_dev/get_branches_for_dirs.sh b/kde_dev/get_branches_for_dirs.sh deleted file mode 100755 index a744732..0000000 --- a/kde_dev/get_branches_for_dirs.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env bash -# Update solus package and infra repos - -current_date=$(date -I) -pr_dirs=() -src_dir=$HOME/kde/src - -# Function to display script usage UPDATE -usage() { - echo "Usage: $0" - echo " -h, --help Display this help message" - echo "This script takes no arguments." - echo '' - echo 'It will check each directory under' - echo ' $HOME/kde/src and print any which are not on master.' -} - -# Silence output for these to avoid cli spam -pushd () { - command pushd "$@" > /dev/null -} - -popd () { - command popd "$@" > /dev/null -} - -# TODO add fix variable --fix / -f and only run fix function if passed - -get_top_branch () { - top_branch_untrimmed=$(git log --oneline --graph --decorate | grep -o 'HEAD -> .*' | awk '/>\s/{ print $3 }') - top_branch="${top_branch_untrimmed%?}" -} - -get_branch_per_dir () { - for dir in $(find ${src_dir} -maxdepth 1 -type d); - do - cd ${dir} - if [[ "${dir}" == *"src/log" || "${dir}" == "${src_dir}" ]]; then - printf "Skipping directory %s\n" ${dir} - continue - fi - - dir_branch=$(git rev-parse --abbrev-ref HEAD) - get_top_branch - if [[ ! "${dir_branch}" == "${top_branch}" ]]; then - printf "%s not on its main branch\n" "${dir}" - pr_dirs+=("${dir}") - fi - - cd ${src_dir} - done - echo "Done checking branches" -} - -print_array () { - a=("$@") - for b in "${a[@]}"; - do - echo "$b" - done -} - -fix_branches () { - a=("$@") - for b in "${a[@]}"; - do - echo "Fixing $b" - cd ${b} - get_top_branch - git reset --hard - git switch ${top_branch} - git fetch && git pull - done -} - -if [[ ( $@ == "--help") || $@ == "-h" ]]; then - usage - exit 0 -fi - -printf "Getting KDE source directory branches...\n" -get_branch_per_dir - -if [[ ${#pr_dirs[@]} -eq 0 ]]; then - echo "[INFO] No directories need to switch branches" - exit 0 -else - printf "\n[INFO] Directories not on the top branch:\n" - print_array "${pr_dirs[@]}" - printf "\n[INFO] Switching branches to top branch\n" - fix_branches "${pr_dirs[@]}" -fi - -printf "[INFO] Directories are up to date" diff --git a/local_backup.sh b/local_backup.sh index 6dcce71..9e2b490 100755 --- a/local_backup.sh +++ b/local_backup.sh @@ -79,7 +79,7 @@ fi echo "Preparing to rsync differences in home directory to backup USB drive." -rsync -azh --exclude '.cache' --exclude 'Videos' --exclude 'Nextcloud' --exclude 'Downloads' --exclude 'VirtualBox VMs' --exclude 'Sync' --exclude '.local/share/Steam' --exclude 'Music' --exclude '.Trash-*' --exclude 'home_backup' --exclude 'SatisfactoryShareSaves' --exclude 'Desktop/S9_backup' --exclude 'mount' --exclude 'isos' --exclude 'Sync' --exclude '.local/share/gvfs-metadata' --progress /home/tracey "$mount_point" --delete 2>&1 | tee "$log_file" +rsync -azh --exclude '.cache' --exclude 'Videos' --exclude 'Nextcloud' --exclude 'Downloads' --exclude 'VirtualBox VMs' --exclude 'Sync' --exclude '.local/share/Steam' --exclude 'Music' --exclude '.Trash-*' --exclude 'home_backup' --exclude 'SatisfactoryShareSaves' --exclude 'Desktop/S9_backup' --exclude 'mount' --exclude 'isos' --exclude 'Sync' --exclude '.local/share/gvfs-metadata' --exclude 'clearbuilt' --progress /home/tracey "$mount_point" --delete 2>&1 | tee "$log_file" sudo rsync -azh --progress /var/lib/libvirt/images "$mount_point"/var --delete 2>&1 | tee "$log_file" diff --git a/solus_utility/safe_remuser.sh b/solus_utility/safe_remuser.sh deleted file mode 100644 index 0b3904a..0000000 --- a/solus_utility/safe_remuser.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -# Create a backup of a user and remove them -# Must be run with sudo or as root - -##Check if the user exists using getent command -user_exists=$(getent passwd $1) - -#If the user doesn't exist, we need not perform the backup, just exit. -if [ -z "$user_exists" ] -then - echo "User '$1' does not exist" -else - echo "Creating backup of home dir for '$1'" - mkdir -p "/root/deleted_users" - tar czvf /root/deleted_users/"$1".tar.gz /home/"$1" - userdel -rf "$1" - echo "Removed user '$1'" -fi diff --git a/solus_utility/show_sof-bin_dirs.sh b/solus_utility/show_sof-bin_dirs.sh deleted file mode 100644 index 8dc1a22..0000000 --- a/solus_utility/show_sof-bin_dirs.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -ISODATE=$(date -I) -get_changed_files - -source ~/.bashrc.d/solus-monorepo-helpers.sh - -get_changed_files () -{ - -} \ No newline at end of file diff --git a/solus_utility/solus_package_backup.sh b/solus_utility/solus_package_backup.sh index faa6d35..c17d8c2 100755 --- a/solus_utility/solus_package_backup.sh +++ b/solus_utility/solus_package_backup.sh @@ -60,4 +60,4 @@ fi print_out "Content of ${FILE}" execute "cat ${FILE} && echo" -echo "Finished exporting package names to ${FILE}" +echo "Finished exporting package names" \ No newline at end of file diff --git a/solus_utility/solus_pkg_provides_or_name.sh b/solus_utility/solus_pkg_provides_or_name.sh deleted file mode 100644 index 65f2cf4..0000000 --- a/solus_utility/solus_pkg_provides_or_name.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -pkgs="asciify autoconf automake bash-completion-devel binutils bison cmake dbus-devel diffstat diffutils expat-devel fakeroot file-devel flex flex-devel g++ gcc gfortran glibc-devel gmp-devel gobject-introspection-devel intltool libarchive-bin libffi-devel libgpg-error-devel libgudev-devel libtool-devel libxcrypt-devel libxml2-devel linux-headers m4 make meson mpc-devel mpfr-devel nano nano-syntax-highlighting nasm ncurses-devel openssl-devel pam-devel patch pkgconf polkit-devel python-devel readline-devel rootlesskit systemd-devel texinfo util-linux-devel ypkg zlib-devel" - -for pkg in $pkgs -do - echo $pkg - eopkg info $pkg | grep Provides - echo "" -done