Compare commits
8 commits
0227f460bf
...
43c803a701
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43c803a701 | ||
|
|
7156b7ff01 | ||
|
|
23196e53d2 | ||
|
|
e22ab5ec1b | ||
|
|
986b3bc1ba | ||
|
|
3d7f669138 | ||
|
|
645fa61ba4 | ||
|
|
444e1f0fc1 |
10 changed files with 216 additions and 5 deletions
|
|
@ -15,6 +15,7 @@ Miscellaneous scripts, e.g. set screen brightness from command line (bug workaro
|
||||||
## Other
|
## Other
|
||||||
* Backup and restore scripts for packages installed on Solus OS
|
* Backup and restore scripts for packages installed on Solus OS
|
||||||
* Set up a Solus OS development environment (update needed)
|
* 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
|
* Backup and restore scripts for Linux systems
|
||||||
* obsidian_hide_inlineTitle.py - Change all Obsidian vaults to hide inline titles
|
* 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
|
* obsidian_get_inlineTitle_values.py - Get the value of inlineTitle in all Obsidian vaults
|
||||||
|
|
|
||||||
|
|
@ -7,20 +7,24 @@ use File::Find::Rule; # find all the subdirectories of a given directory
|
||||||
use File::Path qw(make_path remove_tree);
|
use File::Path qw(make_path remove_tree);
|
||||||
use File::Copy;
|
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 $now = localtime;
|
||||||
my $year = $now->year;
|
my $year = $now->year;
|
||||||
print "Year is $year\n";
|
|
||||||
|
|
||||||
# Get year to archive from current year
|
# Get year to archive from current year
|
||||||
my $lastyear = $now->add_years(-1)->year;
|
my $lastyear = $now->add_years(-1)->year;
|
||||||
my $lasttaxyear = $now->add_years(-2)->year;
|
my $lasttaxyear = $now->add_years(-2)->year;
|
||||||
|
|
||||||
print("Last year was $lastyear and tax year was $lasttaxyear\n");
|
print("Processing taxes for year $lastyear\n");
|
||||||
|
|
||||||
# Define and create folders
|
# Define and create folders
|
||||||
my ( $financial_folder, $financial_archive_folder, $lastyear_folder, $lasttaxyear_folder );
|
my ( $financial_folder, $financial_archive_folder, $lastyear_folder, $lasttaxyear_folder );
|
||||||
$financial_folder = '/home/tracey/Documents/financial/current_year/';
|
$financial_folder = '/home/tracey/Documents/financial/current_year/';
|
||||||
$financial_archive_folder = '/home//Documents/financial/1_financial_archives/';
|
$financial_archive_folder = '/home/tracey/Documents/financial/1_financial_archives/';
|
||||||
$lastyear_folder = $financial_archive_folder . $lastyear . 'FinancialArchives';
|
$lastyear_folder = $financial_archive_folder . $lastyear . 'FinancialArchives';
|
||||||
$lasttaxyear_folder = $financial_archive_folder . $lasttaxyear . 'TaxArchives';
|
$lasttaxyear_folder = $financial_archive_folder . $lasttaxyear . 'TaxArchives';
|
||||||
my @folders = ( $financial_folder, $financial_archive_folder, $lastyear_folder, $lasttaxyear_folder );
|
my @folders = ( $financial_folder, $financial_archive_folder, $lastyear_folder, $lasttaxyear_folder );
|
||||||
|
|
|
||||||
6
kde_dev/README.md
Executable file
6
kde_dev/README.md
Executable file
|
|
@ -0,0 +1,6 @@
|
||||||
|
# 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
|
||||||
67
kde_dev/build_multiple.sh
Executable file
67
kde_dev/build_multiple.sh
Executable file
|
|
@ -0,0 +1,67 @@
|
||||||
|
#!/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"
|
||||||
94
kde_dev/get_branches_for_dirs.sh
Executable file
94
kde_dev/get_branches_for_dirs.sh
Executable file
|
|
@ -0,0 +1,94 @@
|
||||||
|
#!/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"
|
||||||
|
|
@ -79,7 +79,7 @@ fi
|
||||||
|
|
||||||
echo "Preparing to rsync differences in home directory to backup USB drive."
|
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' --exclude 'clearbuilt' --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' --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"
|
sudo rsync -azh --progress /var/lib/libvirt/images "$mount_point"/var --delete 2>&1 | tee "$log_file"
|
||||||
|
|
||||||
|
|
|
||||||
18
solus_utility/safe_remuser.sh
Normal file
18
solus_utility/safe_remuser.sh
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/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
|
||||||
11
solus_utility/show_sof-bin_dirs.sh
Normal file
11
solus_utility/show_sof-bin_dirs.sh
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
ISODATE=$(date -I)
|
||||||
|
get_changed_files
|
||||||
|
|
||||||
|
source ~/.bashrc.d/solus-monorepo-helpers.sh
|
||||||
|
|
||||||
|
get_changed_files ()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -60,4 +60,4 @@ fi
|
||||||
print_out "Content of ${FILE}"
|
print_out "Content of ${FILE}"
|
||||||
execute "cat ${FILE} && echo"
|
execute "cat ${FILE} && echo"
|
||||||
|
|
||||||
echo "Finished exporting package names"
|
echo "Finished exporting package names to ${FILE}"
|
||||||
|
|
|
||||||
10
solus_utility/solus_pkg_provides_or_name.sh
Normal file
10
solus_utility/solus_pkg_provides_or_name.sh
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue