File: uuid-runtime.postinst

package info (click to toggle)
util-linux 2.25.2-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 60,764 kB
  • ctags: 11,189
  • sloc: ansic: 103,273; sh: 18,345; makefile: 322; python: 316; xml: 232; csh: 37; sed: 16
file content (30 lines) | stat: -rw-r--r-- 857 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
set -e

# upgrade existing libuuid user/group.
if getent group libuuid >/dev/null && ! getent group uuidd >/dev/null ; then
	groupmod --new-name uuidd libuuid
fi
if getent passwd libuuid >/dev/null && ! getent passwd uuidd >/dev/null ; then
	# attempt to stop potentially running uuidd, otherwise usermod will fail.
	invoke-rc.d --quiet uuidd stop || true

	# rename user, change shell and set new homedir.
	usermod --login uuidd --shell /bin/false --home /run/uuidd libuuid

	# attemp cleanup of old home directory.
	[ -d /var/lib/libuuid ] && \
		rmdir --ignore-fail-on-non-empty /var/lib/libuuid
fi

# add uuidd user/group if needed.
if ! getent group uuidd >/dev/null; then
	addgroup --system uuidd
fi
if ! getent passwd uuidd >/dev/null; then
	adduser --system --ingroup uuidd \
		--home /run/uuidd --no-create-home \
		uuidd
fi

#DEBHELPER#