diff options
author | tv <tv@shackspace.de> | 2015-06-18 21:42:21 +0200 |
---|---|---|
committer | tv <tv@shackspace.de> | 2015-06-18 21:42:21 +0200 |
commit | 99c1e067b17d9b57245ee793c7b08b0c93de54b0 (patch) | |
tree | f2141c504dd77ea03d1bd9b37903c7f5d04c440f | |
parent | de741c98a711dd3e2d7b060d5d0f0e196f1b8f2e (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 000000000..8e2240746 --- /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 |