File: mock-nss.sh

package info (click to toggle)
golang-github-crc-org-crc 2.34.0%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,548 kB
  • sloc: sh: 398; makefile: 326; javascript: 40
file content (18 lines) | stat: -rwxr-xr-x 425 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash

# mock passwd and group files
(
  exec 2>/dev/null
  username="${NSS_USERNAME:-$(id -un)}"
  uid="${NSS_UID:-$(id -u)}"

  groupname="${NSS_GROUPNAME:-$(id -gn)}"
  gid="${NSS_GID:-$(id -g)}"

  echo "${username}:x:${uid}:${uid}:gecos:${HOME}:/bin/bash" > "${NSS_WRAPPER_PASSWD}"
  echo "${groupname}:x:${gid}:" > "${NSS_WRAPPER_GROUP}"
)

# wrap command
export LD_PRELOAD=/usr/lib64/libnss_wrapper.so
exec "$@"