ignore .inst and .uninst files

add systemd loginctl commands
btrfs find subvolumes
master
David Kebler 2023-12-14 13:59:24 -08:00
parent f2a9d64eab
commit 9157278eb0
8 changed files with 45 additions and 3 deletions

View File

@ -5,6 +5,8 @@
*.example
*.tmpl
*.template
*.inst
*.uinst
*.md
*TODO*
*.log

View File

@ -62,3 +62,5 @@ alias follow="readlink -f"
# use this when there are transport errors after unmounting or killing a mount
alias umountf="sudo umount -l"
alias loginust="loginctl show-user $USER"

View File

@ -10,3 +10,4 @@ alias sdlau="systemctl --user list-units | grep"
alias sdlu="systemctl --user list-unit-files | grep"
alias sdleu="systemctl --user list-unit-files | grep enabled"
alias sdpidu="systemctl show --user --property MainPID --value"

View File

@ -68,4 +68,27 @@ echo $subvolumeFolderSize KB
echo "~ $((subvolumeFolderSize/1024)) MB"
echo "~ $((subvolumeFolderSize/1024/1024)) GB"
}
}
find_subvolumes () {
sudo /bin/find $1 -maxdepth $2 -type d -exec sh -c '
for d do
sudo btrfs subvolume show "$d" >/dev/null 2>&1 && printf "%s\n" "$d"
done' find-sh {} +
}
# sudo find / -type d -exec sh -c '
# for d do
# btrfs subvolume show "$d" >/dev/null 2>&1 && printf "%s\n" "$d"
# done' find-sh {} +
# You may want to exclude paths that are beyond suspicion. The following code excludes /proc, /sys and /dev:
# sudo find / -type d \( \
# \( -path /proc -prune \) -o \
# \( -path /sys -prune \) -o \
# \( -path /dev -prune \) -o \
# \( -exec sh -c '
# for d do
# btrfs subvolume show "$d" >/dev/null 2>&1 && printf "%s\n" "$d"
# done
# ' find-sh {} + \) \)

View File

@ -93,3 +93,6 @@ sed_ignore_comments () {
fi
}
#rows between matched rows
# sed '1,/firstmatch/d;/secondmatch/,$d'

View File

@ -38,3 +38,15 @@ systemctl --user show --no-page $1 | grep ExecMainPID
systemctl --user show --no-page $1 | grep ExecMainStartTimestamp=
systemctl --user show --no-page $1 | grep ExecMainExitTimestamp=
}
function sdeub {
loginctl enable-linger
}
function sddub {
loginctl disable-linger
}
function sdstub {
[[ $(loginctl show-user "$USER" --property=Linger | cut -d= -f2) == 'yes' ]] && echo enabled || echo disabled
}

View File

@ -61,11 +61,10 @@ function _find () {
# all lines ending in / will be treated as directory names to ignore, otherwise files
# p option explictly excludes paths(directories)
# d option sets the directory depth which is current directy by default, 0 is all
# x excitly excludes file globs as a string
# n inclucdes only file globs otherwise it's all except .files
# if no directory is given it will attempt to source the present working directory
# example:
# source_dir -p "archive" -x '"*.off" "*.md"' -d 0 # $DIR/$SUBDIR
# source_dir -p "archive" -e '"*.off" "*.md"' -d 0 # $DIR/$SUBDIR
local EXCLUDE_FILE
local PATHS
local NAMES