26 lines
		
	
	
		
			644 B
		
	
	
	
		
			Bash
		
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			644 B
		
	
	
	
		
			Bash
		
	
	
	
| #!/hint/bash -euE
 | |
| # Copyright (C) 2018  Luke Shumaker
 | |
| # SPDX-License-Identifier: AGPL-3.0-or-later
 | |
| 
 | |
| post_install+=(01:testuser:early)
 | |
| testuser:early() {
 | |
| 	local arg_mountpoint=$1
 | |
| 
 | |
| 	if ! grep -q ^testuser: -- "$arg_mountpoint/etc/passwd"; then
 | |
| 		arch-chroot -- "$arg_mountpoint" useradd \
 | |
| 		       --gid=users \
 | |
| 		       --comment='Test User' \
 | |
| 		       --create-home \
 | |
| 		       testuser
 | |
| 	fi
 | |
| }
 | |
| 
 | |
| post_install+=(90: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"
 | |
| }
 |