aboutsummaryrefslogtreecommitdiff
path: root/kshrc
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2025-12-03 21:03:35 -0500
committerMitchell Riedstra <mitch@riedstra.dev>2025-12-03 21:03:35 -0500
commitcd0f9163da3b647bdc7d7f716750fd4f56fdd8eb (patch)
treeae2869e5ce375a929db0c1bf4689d9e03dcd40ac /kshrc
parent3650ff34c6b50966898cc33cb15337c784510a84 (diff)
downloaddotfiles-cd0f9163da3b647bdc7d7f716750fd4f56fdd8eb.tar.gz
dotfiles-cd0f9163da3b647bdc7d7f716750fd4f56fdd8eb.tar.xz
Add subid shell func
Diffstat (limited to 'kshrc')
-rw-r--r--kshrc29
1 files changed, 29 insertions, 0 deletions
diff --git a/kshrc b/kshrc
index d6a5207..816fe1b 100644
--- a/kshrc
+++ b/kshrc
@@ -373,6 +373,35 @@ passenv() {
rm -f "$_f"
}
+# gensubids is useful for generating /etc/subuid and /etc/subgid
+# if you have say a 3rd user you want to add
+gensubids() {
+ _step=65536
+ _err=0
+ _un=
+ _n=
+ while [ $# -gt 0 ] ; do case $1 in
+ -u) _un="$2"; shift ; shift ;;
+ -n) _n="$2"; shift ; shift ;;
+ *)
+ echo "unknown option: $1";
+ echo "gensubids -u <username> -n <entry_number>";
+ return 1 ;;
+ esac ; done
+ if [ -z "$_n" ] ; then
+ echo "need a number"
+ _err=1
+ fi
+ if [ -z "$_un" ] ; then
+ echo "need a username"
+ _err=1
+ fi
+ if [ "$_err" -eq 1 ] ; then
+ return 1;
+ fi
+ echo "$_un:$(( (_n*_step) + 1 )):$(( (_n*_step) + _step ))"
+}
+
scangit() {
ref="origin/master"
while [ $# -gt 0 ] ; do case $1 in