2018-08-06 00:09:42 +00:00
|
|
|
#!/hint/bash
|
|
|
|
|
2018-08-06 01:49:45 +00:00
|
|
|
post_install+=(01:testuser:early)
|
|
|
|
testuser:early() {
|
2018-08-06 00:09:42 +00:00
|
|
|
local arg_mountpoint=$1
|
|
|
|
|
|
|
|
useradd --root="$arg_mountpoint" \
|
|
|
|
--gid=users \
|
|
|
|
--comment='Test User' \
|
|
|
|
--create-home \
|
|
|
|
testuser
|
2018-08-06 01:49:45 +00:00
|
|
|
}
|
2018-08-06 00:09:42 +00:00
|
|
|
|
2018-08-06 01:49:45 +00:00
|
|
|
post_install+=(99:testuser:late)
|
|
|
|
testuser:late() {
|
|
|
|
local arg_mountpoint=$1
|
2018-08-06 00:09:42 +00:00
|
|
|
|
2018-08-06 01:49:45 +00:00
|
|
|
local uidgid
|
|
|
|
uidgid=$(awk -v FS=: -v OFS=: '$1 == "testuser" { print $3, $4 }' < "${arg_mountpoint}/etc/passwd")
|
|
|
|
chown -R -- "$uidgid" "${arg_mountpoint}/home/testuser"
|
2018-08-06 00:09:42 +00:00
|
|
|
}
|