53 lines
1.8 KiB
Bash
53 lines
1.8 KiB
Bash
#!/hint/bash -euE
|
|
# Copyright (C) 2018 Luke Shumaker
|
|
# Copyright (C) 2023 Umorpha Systems
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
load_module "$(dirname -- "${BASH_SOURCE[0]}")/base-sshd.sh"
|
|
|
|
packages+=(
|
|
# Functionality
|
|
sudo
|
|
|
|
# Experience
|
|
less
|
|
bash-completion
|
|
rxvt-unicode-terminfo
|
|
man-db
|
|
)
|
|
|
|
post_install+=(
|
|
20:umorpha-sshusers:early
|
|
70:umorpha-sshusers:late
|
|
)
|
|
|
|
umorpha-sshusers:early() {
|
|
local arg_mountpoint=$1
|
|
|
|
echo en_US.UTF-8 UTF-8 >"${arg_mountpoint}/etc/locale.gen"
|
|
arch-chroot -- "$arg_mountpoint" locale-gen
|
|
|
|
cat >"${arg_mountpoint}/etc/locale.conf" <<-EOF
|
|
LANG=en_US.UTF-8
|
|
LC_COLLATE=C
|
|
EOF
|
|
|
|
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'
|
|
}
|
|
|
|
umorpha-sshusers: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
|
|
}
|