Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
2.0 kB · 67 lines
Shell
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768#!/bin/bash
set -exuo pipefail
sudo modprobe loop
pkgs=(stratis{d,-cli} container-selinux kernel-modules-extra)rpm -q "${pkgs[@]}" || sudo dnf install -y "${pkgs[@]}"sudo systemctl enable --now stratisd
sudo tee /etc/dbus-1/system.d/stratisd.conf <<EOF<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"><busconfig> <policy user="$(id -nu)"> <allow own="org.storage.stratis3"/> <allow send_destination="org.storage.stratis3"/> </policy></busconfig>EOF
sudo tee /etc/polkit-1/rules.d/restart-stratisd.rules <<EOFpolkit.addRule(function(action, subject) { if (action.id == 'org.freedesktop.systemd1.manage-units' && action.lookup('unit') == 'stratisd.service' && subject.user == '$(id -nu)') { return polkit.Result.YES; }});EOF
sudo systemctl restart polkit stratisd
sudo mkdir -p /var/imagesi=0for name in primary secondary; do path=/var/images/$name.img pool=topolvm-$name [[ -f $path ]] || sudo fallocate -l 16GiB $path [[ -e /dev/loop$i ]] || sudo mknod -m 0660 /dev/loop$i b 7 $i losetup -l | grep -q loop$i || sudo losetup /dev/loop$i $path
# XXX: this detection is all rather racy, so we try to create it a bit # aggressively and then fall back to multiple detection attempts. stratis pool | grep -q $pool || { stratis pool create $pool /dev/loop$i || { for _ in {1..3}; do sleep 1 stratis pool | grep -vq $pool || break done stratis pool | grep -q $pool } }
stratis pool list --name $pool | grep -q 'Overprovisioning: No' \ || stratis pool overprovision $pool no
i=$(($i+1))done
# NOTE: a regex in the updatecli config depends on this exact syntax!export INSTALL_K3S_VERSION=v1.36.4+k3s1
curl -sfL https://get.k3s.io | sh -s - \ --disable-helm-controller --disable=traefik \ --selinux \ --write-kubeconfig-mode=644