#!/hint/bash -euE # Copyright (C) 2018 Luke Shumaker # Copyright (C) 2023 Umorpha Systems # SPDX-License-Identifier: AGPL-3.0-or-later packages+=(sudo) post_install+=(01:umorpha-users:post_install:early) umorpha-users:post_install:early() { local arg_mountpoint=$1 echo '%wheel ALL=(ALL) ALL' >"$arg_mountpoint/etc/sudoers.d/00-wheel" useradd --root="$arg_mountpoint" --gid=users --comment='Luke T. Shumaker' --create-home lukeshu passwd --root="$arg_mountpoint" --delete --expire lukeshu gpasswd --root="$arg_mountpoint" --add=lukeshu wheel mkdir "$arg_mountpoint/home/lukeshu/.ssh" echo >"$arg_mountpoint/home/lukeshu/.ssh/authorized_keys" 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDIOENnrA4fx+1DZE0oTpX84Rncc0yYKtUXM+1WIa+jHB4L0d5dCnvKshD5yi3G4TT5PhUSM+S/8zrnt9Ytug75Y3BRqG6ZIAeWc662X2z97ExDJZlV5KW7C1dVzMjM/EVyRV2ey0AqiaW/71lOkVw/AR2crggV2YfA24ecDN5tHVJGoxdi6isQyD2w0w1PnMWiXQR9aQ2kp9qv4MdW8sEYMmVSi3i5CNOQdYc+YIXsYfUSDiQ1YYVdvtHE7HprX86SCtqZCETKiYXxY0rtvJ+uI9aPmSpdEEo34EgwFtuYr+9sIfEhjL9+Hy/5+6HuksSpEY61UamiLUJhD7c1lZUpo93+oxHhRSzTvdTVoTRbZCu2iAmOJRhcqpLmhuHz2JesD73I+RmatTXGPaCkMex12QqGPvmhArxg8Btkd9ZiXFJZJgn11GiHBVTiAlf27pKXy0k2Il3iS+gcU7yndgoMI45WLh/vSHveHJ3IMEc1cZmBE70e8D3yp16cusn9bZ8= lukeshu@lukeshu-thinkpad-e15' } post_install+=(99:umorpha-users:post_install:late) umorpha-users:post_install:late() { local arg_mountpoint=$1 local user uidgid for user in lukeshu; do uidgid=$(awk -v FS=: -v OFS=: "\$1 == "$user" { print \$3, \$4 }" <"$arg_mountpoint/etc/passwd") chown -R -- "$uidgid" "$arg_mountpoint/home/$user" done }