diff options
author | tv <tv@krebsco.de> | 2015-06-18 21:42:21 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2015-06-18 21:42:21 +0200 |
commit | c73da15eb4997a727351ec16e5f6200bd00b192a (patch) | |
tree | f2141c504dd77ea03d1bd9b37903c7f5d04c440f | |
parent | d4e96cd9aa883b7a8f65573553820e10c46a38c7 (diff) |
bin/genid: initial commit
-rwxr-xr-x | bin/genid | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/genid b/bin/genid new file mode 100755 index 0000000..8e22407 --- /dev/null +++ b/bin/genid @@ -0,0 +1,11 @@ +#! /bin/sh +# usage: genid NAME +set -euf +name=$1 +hash=$(printf %s "$name" | sha1sum | cut -d\ -f1 | tr a-f A-F) +echo " + min=2^16 # bigger than nobody and nogroup, see <nixos/modules/misc/ids.nix> + max=2^32 # see 2^(8*sizeof(uid_t)) + ibase=16 + ($hash + min) % max +" | bc |