test(packer): add image for opensuse & some cleanup.
This commit is contained in:
parent
46165fe58f
commit
9731a09588
5 changed files with 112 additions and 13 deletions
|
|
@ -5,24 +5,37 @@
|
|||
|
||||
set -eu
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
_lsb_release() { . /etc/os-release; echo "$ID"; }
|
||||
_lsb_release() {
|
||||
# shellcheck source=/dev/null
|
||||
. /etc/os-release
|
||||
echo "$ID"
|
||||
}
|
||||
DISTRIBUTION="$(_lsb_release)"
|
||||
readonly SRC=/tmp/src
|
||||
readonly DISTRIBUTION
|
||||
|
||||
main() {
|
||||
install -dm0750 -o "$SUDO_USER" -g "$SUDO_USER" "/home/$SUDO_USER/Projects/" "/home/$SUDO_USER/.config/"
|
||||
install -dm0750 -o "$SUDO_USER" -g "$SUDO_USER" "/home/$SUDO_USER/Projects/" "/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/htoprc "/home/$SUDO_USER/.config/htop/htoprc"
|
||||
install -Dm0644 $SRC/parser.conf /etc/apparmor/parser.conf
|
||||
install -Dm0644 $SRC/site.local /etc/apparmor.d/tunables/etc.d/site.local
|
||||
install -Dm0644 $SRC/site.local /etc/apparmor.d/tunables/multiarch.d/site.local
|
||||
install -Dm0755 $SRC/aa-update /usr/bin/aa-update
|
||||
chown -R "$SUDO_USER:$SUDO_USER" "/home/$SUDO_USER/.config/"
|
||||
case "$DISTRIBUTION" in
|
||||
debian | ubuntu) dpkg -i $SRC/apparmor.d_*_all.deb ;;
|
||||
opensuse*) zypper install -y bash-completion git go htop make rsync vim ;;
|
||||
arch) pacman --noconfirm -U $SRC/apparmor.d-*-x86_64.pkg.tar.zst ;;
|
||||
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 \
|
||||
debhelper devscripts htop qemu-guest-agent rsync vim
|
||||
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
|
||||
;;
|
||||
|
||||
esac
|
||||
}
|
||||
|
||||
|
|
|
|||
33
tests/packer/init/opensuse-kde.user-data.yml
Normal file
33
tests/packer/init/opensuse-kde.user-data.yml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#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:
|
||||
- bash-completion
|
||||
- git
|
||||
- go
|
||||
- htop
|
||||
- make
|
||||
- rsync
|
||||
- vim
|
||||
|
||||
runcmd:
|
||||
|
||||
# Set some bash aliases
|
||||
- echo '[[ -f ~/.bash_aliases ]] && source ~/.bash_aliases' >> /home/${username}/.bashrc
|
||||
Loading…
Add table
Add a link
Reference in a new issue