22 lines
454 B
Bash
22 lines
454 B
Bash
#!/hint/bash
|
|
|
|
post_install+=(01:testuser:early)
|
|
testuser:early() {
|
|
local arg_mountpoint=$1
|
|
|
|
chroot "$arg_mountpoint" useradd \
|
|
--gid=users \
|
|
--comment='Test User' \
|
|
--create-home \
|
|
testuser
|
|
}
|
|
|
|
post_install+=(99:testuser:late)
|
|
testuser:late() {
|
|
local arg_mountpoint=$1
|
|
|
|
local uidgid
|
|
uidgid=$(awk -v FS=: -v OFS=: '$1 == "testuser" { print $3, $4 }' < "${arg_mountpoint}/etc/passwd")
|
|
chown -R -- "$uidgid" "${arg_mountpoint}/home/testuser"
|
|
}
|