test(packer): as base image for the cosmic DE.

This commit is contained in:
Alexandre Pujol 2024-10-07 21:41:44 +01:00
parent 4f861158cf
commit 146bda8f45
Failed to generate hash of commit
3 changed files with 104 additions and 10 deletions

View file

@ -18,6 +18,10 @@ boxes:
box: aa-archlinux-xfce
uefi: false
- name: arch-cosmic
box: aa-archlinux-cosmic
uefi: false
- name: arch-server
box: aa-archlinux-server
uefi: false

View file

@ -0,0 +1,90 @@
#cloud-config
hostname: ${hostname}
locale: en_IE
keyboard:
layout: ie
ssh_pwauth: true
users:
- name: ${username}
plain_text_passwd: ${password}
shell: /bin/bash
ssh_authorized_keys:
- ${ssh_key}
lock_passwd: false
sudo: ALL=(ALL) NOPASSWD:ALL
package_update: true
package_upgrade: true
package_reboot_if_required: false
packages:
# Install core packages
- apparmor
- audit
- base-devel
- firewalld
- qemu-guest-agent
- rng-tools
- spice-vdagent
# Install usefull core packages
- bash-completion
- git
- htop
- man
- pass
- python-notify2
- vim
- wget
# Install basic services
- networkmanager
- cups
- cups-pdf
- system-config-printer
# Install Graphical Interface
- cosmic
# Install Applications
- firefox
- chromium
- terminator
runcmd:
# Regenerate grub.cfg
- grub-mkconfig -o /boot/grub/grub.cfg
# Remove swapfile
- swapoff -a
- rm -rf /swap/
- sed -e "/swap/d" -i /etc/fstab
# Enable core services
- systemctl enable apparmor
- systemctl enable auditd
- systemctl enable cosmic-greeter
- systemctl enable NetworkManager
- systemctl enable rngd
- systemctl enable avahi-daemon
- systemctl enable systemd-timesyncd.service
write_files:
# Enable AppArmor in kernel parameters
- path: /etc/default/grub
append: true
content: |
GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT lsm=landlock,lockdown,yama,integrity,apparmor,bpf apparmor.debug=1"
# Set some bash aliases
- path: /etc/skel/.bashrc
append: true
content: |
[[ -f ~/.bash_aliases ]] && source ~/.bash_aliases
# Setup shared directory
- path: /etc/fstab
append: true
content: |
0a31bc478ef8e2461a4b1cc10a24cc4 /home/user/Projects/apparmor.d virtiofs defaults 0 1

View file

@ -15,16 +15,6 @@ readonly SRC=/tmp/src
readonly DISTRIBUTION
main() {
install -dm0750 -o "$SUDO_USER" -g "$SUDO_USER" "/home/$SUDO_USER/Projects/" "/home/$SUDO_USER/Projects/apparmor.d" "/home/$SUDO_USER/.config/"
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/.bash_aliases "/home/$SUDO_USER/.bash_aliases"
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/monitors.xml "/home/$SUDO_USER/.config/monitors.xml"
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/htoprc "/home/$SUDO_USER/.config/htop/htoprc"
install -Dm0644 $SRC/site.local /etc/apparmor.d/tunables/multiarch.d/site.local
install -Dm0755 $SRC/aa-update /usr/bin/aa-update
install -Dm0755 $SRC/aa-log-clean /usr/bin/aa-log-clean
cat $SRC/parser.conf >>/etc/apparmor/parser.conf
chown -R "$SUDO_USER:$SUDO_USER" "/home/$SUDO_USER/.config/"
case "$DISTRIBUTION" in
arch)
pacman --noconfirm -U $SRC/*.pkg.tar.zst
@ -45,6 +35,16 @@ main() {
;;
esac
install -dm0750 -o "$SUDO_USER" -g "$SUDO_USER" "/home/$SUDO_USER/Projects/" "/home/$SUDO_USER/Projects/apparmor.d" "/home/$SUDO_USER/.config/"
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/.bash_aliases "/home/$SUDO_USER/.bash_aliases"
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/monitors.xml "/home/$SUDO_USER/.config/monitors.xml"
install -Dm0644 -o "$SUDO_USER" -g "$SUDO_USER" $SRC/htoprc "/home/$SUDO_USER/.config/htop/htoprc"
install -Dm0644 $SRC/site.local /etc/apparmor.d/tunables/multiarch.d/site.local
install -Dm0755 $SRC/aa-update /usr/bin/aa-update
install -Dm0755 $SRC/aa-log-clean /usr/bin/aa-log-clean
cat $SRC/parser.conf >>/etc/apparmor/parser.conf
chown -R "$SUDO_USER:$SUDO_USER" "/home/$SUDO_USER/.config/"
}
main "$@"