osi-tools/Documentation/module-examples/libretools.sh

36 lines
1021 B
Bash

#!/hint/bash -euE
# Copyright (C) 2018 Luke Shumaker
# SPDX-License-Identifier: AGPL-3.0-or-later
load_module "$(dirname -- "${BASH_SOURCE[0]}")/testuser.sh"
packages+=(
sudo
libretools
)
cache_packages+=(
base-devel
)
post_install+=(10:libretools:post_install)
libretools:post_install() {
local arg_mountpoint=$1
cat <<-'EOT' > "${arg_mountpoint}/etc/sudoers.d/10-libretools"
# SUDO_USERS HOSTS=(AS_USER) TAGS COMMANDS
%users ALL=(ALL) NOPASSWD: SETENV: /usr/bin/librechroot, /usr/bin/libremakepkg
EOT
mkdir -p -- "${arg_mountpoint}/home/testuser/.config/pacman"
cat <<-'EOT' > "${arg_mountpoint}/home/testuser/.config/pacman/makepkg.conf"
#!/hint/bash
PKGDEST="${LIBREHOME:-$HOME}/packages/pkgdest"
SRCDEST="${LIBREHOME:-$HOME}/packages/srcdest"
SRCPKGDEST="${LIBREHOME:-$HOME}/packages/srcpkgdest"
LOGDEST="${LIBREHOME:-$HOME}/packages/logdest"
PACKAGER="Test User <testuser@example.com>"
EOT
mkdir -- "$arg_mountpoint"/home/testuser/packages/{,pkgdest,srcdest,srcpkgdest,logdest}
}