2023-04-16 22:28:58 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# apparmor.d - Full set of apparmor profiles
|
|
|
|
# Copyright (C) 2023 Alexandre Pujol <alexandre@pujol.io>
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2023-04-30 17:26:16 +02:00
|
|
|
_lsb_release() {
|
|
|
|
# shellcheck source=/dev/null
|
|
|
|
. /etc/os-release
|
|
|
|
echo "$ID"
|
|
|
|
}
|
2023-04-16 22:28:58 +02:00
|
|
|
DISTRIBUTION="$(_lsb_release)"
|
|
|
|
readonly SRC=/tmp/src
|
|
|
|
readonly DISTRIBUTION
|
|
|
|
|
|
|
|
main() {
|
2023-04-30 17:26:16 +02:00
|
|
|
install -dm0750 -o "$SUDO_USER" -g "$SUDO_USER" "/home/$SUDO_USER/Projects/" "/home/$SUDO_USER/.config/"
|
2023-04-16 22:28:58 +02:00
|
|
|
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/.bash_aliases "/home/$SUDO_USER/.bash_aliases"
|
2023-07-18 23:22:08 +02:00
|
|
|
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/monitors.xml "/home/$SUDO_USER/.config/monitors.xml"
|
2023-04-16 22:28:58 +02:00
|
|
|
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/htoprc "/home/$SUDO_USER/.config/htop/htoprc"
|
|
|
|
install -Dm0644 $SRC/parser.conf /etc/apparmor/parser.conf
|
2023-04-30 17:26:16 +02:00
|
|
|
install -Dm0644 $SRC/site.local /etc/apparmor.d/tunables/multiarch.d/site.local
|
2023-04-16 22:28:58 +02:00
|
|
|
install -Dm0755 $SRC/aa-update /usr/bin/aa-update
|
2023-07-08 13:34:18 +02:00
|
|
|
install -Dm0755 $SRC/aa-log-clean /usr/bin/aa-log-clean
|
2023-04-16 22:28:58 +02:00
|
|
|
chown -R "$SUDO_USER:$SUDO_USER" "/home/$SUDO_USER/.config/"
|
|
|
|
case "$DISTRIBUTION" in
|
2023-04-30 17:26:16 +02:00
|
|
|
arch) pacman --noconfirm -U $SRC/apparmor.d-*-x86_64.pkg.tar.zst ;;
|
|
|
|
debian | ubuntu)
|
|
|
|
apt-get update -y
|
|
|
|
apt-get install -y apparmor-profiles build-essential config-package-dev \
|
2023-07-18 23:22:08 +02:00
|
|
|
debhelper devscripts htop rsync vim
|
2023-04-30 17:26:16 +02:00
|
|
|
dpkg -i $SRC/apparmor.d_*_all.deb
|
|
|
|
;;
|
|
|
|
|
|
|
|
opensuse*)
|
|
|
|
zypper install -y bash-completion git go htop make rsync vim
|
|
|
|
sed -i -e '/cache-loc/d' /etc/apparmor/parser.conf
|
|
|
|
;;
|
|
|
|
|
2023-04-16 22:28:58 +02:00
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
main "$@"
|