feat: system setup + groups setup
This commit is contained in:
parent
ce5f8d958a
commit
cd4b46af78
5 changed files with 56 additions and 0 deletions
4
build.sh
4
build.sh
|
@ -36,6 +36,10 @@ cp /tmp/build/flatpak-setup.service /usr/lib/systemd/user/flatpak-setup.service
|
|||
#### Services
|
||||
|
||||
systemctl enable docker.socket
|
||||
systemctl enable incus.socket
|
||||
systemctl enable podman.socket
|
||||
systemctl enable tailscaled.service
|
||||
systemctl enable -f --global flatpak-setup.service
|
||||
|
||||
systemctl enable azure-system-setup.service
|
||||
systemctl enable azure-groups.service
|
||||
|
|
12
files/usr/lib/systemd/system/azure-groups.service
Normal file
12
files/usr/lib/systemd/system/azure-groups.service
Normal file
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=Add wheel members to docker, incus and libvirt groups
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/libexec/azure-groups
|
||||
Restart=on-failure
|
||||
RestartSec=30
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
12
files/usr/lib/systemd/system/azure-system-setup.service
Normal file
12
files/usr/lib/systemd/system/azure-system-setup.service
Normal file
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=Configure system
|
||||
After=rpm-ostreed.service
|
||||
Before=systemd-user-sessions.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/usr/libexec/azure-system-setup
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
25
files/usr/libexec/azure-groups
Executable file
25
files/usr/libexec/azure-groups
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# SCRIPT VERSION
|
||||
GROUP_SETUP_VER=1
|
||||
GROUP_SETUP_VER_FILE="/etc/azure/groups"
|
||||
GROUP_SETUP_VER_RAN=$(cat "$GROUP_SETUP_VER_FILE")
|
||||
|
||||
# Run script if updated
|
||||
if [[ -f $GROUP_SETUP_VER_FILE && "$GROUP_SETUP_VER" = "$GROUP_SETUP_VER_RAN" ]]; then
|
||||
echo "Group setup has already run. Exiting..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Setup Groups
|
||||
wheelarray=($(getent group wheel | cut -d ":" -f 4 | tr ',' '\n'))
|
||||
for user in $wheelarray
|
||||
do
|
||||
usermod -aG docker $user
|
||||
usermod -aG incus-admin $user
|
||||
usermod -aG libvirt $user
|
||||
done
|
||||
|
||||
# Prevent future executions
|
||||
echo "Writing state file"
|
||||
echo "$GROUP_SETUP_VER" > "$GROUP_SETUP_VER_FILE"
|
3
files/usr/libexec/azure-system-setup
Executable file
3
files/usr/libexec/azure-system-setup
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
mkdir -p /etc/azure
|
Loading…
Reference in a new issue