Browse Source

OK to DONE

main
pvincent 8 months ago
parent
commit
f9f22ee92e
  1. 8
      README.md
  2. 12
      lib/install.sh
  3. 4
      scripts/miaou

8
README.md

@ -55,7 +55,10 @@ Debian12 fresh install
* # log as normal user with sudo group * # log as normal user with sudo group
* sudo apt install -y git * sudo apt install -y git
* git clone https://git.artcode.re/miaou/miaou.git * git clone https://git.artcode.re/miaou/miaou.git
* ./miaou/lib/install.sh dev
* # EITHER:
* ./miaou/lib/install.sh dev
* # OR:
* EMAIL=<your email> ./miaou/lib/install.sh dev
Nested container test drive Nested container test drive
---------------------------- ----------------------------
@ -63,10 +66,7 @@ Nested container test drive
* CONTAINER=nested * CONTAINER=nested
* lxc-miaou-create $CONTAINER -o sameuser,nesting * lxc-miaou-create $CONTAINER -o sameuser,nesting
* lxc sameuser $CONTAINER * lxc sameuser $CONTAINER
* # EITHER:
* /opt/miaou/lib/install.sh dev * /opt/miaou/lib/install.sh dev
* # OR
* EMAIL=<your email> /opt/miaou/lib/install.sh dev
Hardening server Hardening server
---------------- ----------------

12
lib/install.sh

@ -123,7 +123,6 @@ profiles:
projects: [] projects: []
cluster: null cluster: null
EOF EOF
echo OK
else else
echo "--------------------------------" echo "--------------------------------"
echo "use dir partition for development purpose" echo "use dir partition for development purpose"
@ -283,7 +282,7 @@ function miaou_configfiles() {
echo -n "configuration initializing ..." echo -n "configuration initializing ..."
sudo mkdir -p /etc/miaou sudo mkdir -p /etc/miaou
sudo chown "$USER" /etc/miaou sudo chown "$USER" /etc/miaou
PREFIX="" echoinfo OK
PREFIX="" echoinfo DONE
fi fi
if [[ ! -f /etc/miaou/defaults.yaml ]]; then if [[ ! -f /etc/miaou/defaults.yaml ]]; then
@ -291,13 +290,13 @@ function miaou_configfiles() {
shadow_passwd=$(sudo grep "$CURRENT_USER" /etc/shadow | cut -d ':' -f2) shadow_passwd=$(sudo grep "$CURRENT_USER" /etc/shadow | cut -d ':' -f2)
env current_user="$CURRENT_USER" shadow_passwd="$shadow_passwd" valid_email="$valid_email" tera -e --env-key env --env-only -t "$MIAOU_BASEDIR/templates/etc/defaults.yaml.j2" -o /etc/miaou/defaults.yaml >/dev/null env current_user="$CURRENT_USER" shadow_passwd="$shadow_passwd" valid_email="$valid_email" tera -e --env-key env --env-only -t "$MIAOU_BASEDIR/templates/etc/defaults.yaml.j2" -o /etc/miaou/defaults.yaml >/dev/null
yq ".target=\"$TARGET\"" /etc/miaou/defaults.yaml -i yq ".target=\"$TARGET\"" /etc/miaou/defaults.yaml -i
PREFIX="" echoinfo OK
PREFIX="" echoinfo DONE
fi fi
if [[ ! -f /etc/miaou/miaou.yaml ]]; then if [[ ! -f /etc/miaou/miaou.yaml ]]; then
echo -n "building /etc/miaou/miaou.yaml for the first time..." echo -n "building /etc/miaou/miaou.yaml for the first time..."
cp "$MIAOU_BASEDIR/templates/etc/miaou.yaml.j2" /etc/miaou/miaou.yaml cp "$MIAOU_BASEDIR/templates/etc/miaou.yaml.j2" /etc/miaou/miaou.yaml
PREFIX="" echoinfo OK
PREFIX="" echoinfo DONE
fi fi
PREVIOUS_TARGET="" PREVIOUS_TARGET=""
@ -349,7 +348,7 @@ function miaou_resolver() {
sudo chmod +x /etc/NetworkManager/dispatcher.d/50-miaou-resolver sudo chmod +x /etc/NetworkManager/dispatcher.d/50-miaou-resolver
ACTIVE_CONNECTION=$(nmcli -g NAME connection show --active | head -n1) ACTIVE_CONNECTION=$(nmcli -g NAME connection show --active | head -n1)
sudo nmcli connection up "$ACTIVE_CONNECTION" &>/dev/null sudo nmcli connection up "$ACTIVE_CONNECTION" &>/dev/null
PREFIX="" echoinfo OK
PREFIX="" echoinfo DONE
else else
echo "miaou-resolver in NetworkManager dispatcher already initialized!" echo "miaou-resolver in NetworkManager dispatcher already initialized!"
fi fi
@ -358,7 +357,6 @@ function miaou_resolver() {
echo -n "disabling systemd-resolved..." echo -n "disabling systemd-resolved..."
sudo systemctl stop systemd-resolved.service --quiet sudo systemctl stop systemd-resolved.service --quiet
sudo systemctl disable systemd-resolved.service --quiet sudo systemctl disable systemd-resolved.service --quiet
sudo rm /etc/resolv.conf
PREFIX="" echoinfo DONE PREFIX="" echoinfo DONE
fi fi
@ -419,7 +417,7 @@ function preload_bookworm_image {
if [[ $(lxc image list debian/12/cloud -f csv | wc -l) -lt 1 ]]; then if [[ $(lxc image list debian/12/cloud -f csv | wc -l) -lt 1 ]]; then
echo -n "downloading images from public remote, please hold on..." echo -n "downloading images from public remote, please hold on..."
sg $NEW_GROUP -c 'lxc image copy images:debian/12/cloud local: --copy-aliases --quiet' sg $NEW_GROUP -c 'lxc image copy images:debian/12/cloud local: --copy-aliases --quiet'
PREFIX="" echoinfo OK
PREFIX="" echoinfo DONE
else else
echo -n "refreshing images from public remote..." echo -n "refreshing images from public remote..."
sg $NEW_GROUP -c 'lxc image refresh debian/12/cloud --quiet' sg $NEW_GROUP -c 'lxc image refresh debian/12/cloud --quiet'

4
scripts/miaou

@ -279,12 +279,12 @@ function build_nftables() {
tera -t "$MIAOU_BASEDIR/templates/nftables/lxd.table.j2" "$EXPANDED_CONF" -o "$MIAOU_CONFIGDIR/nftables.rules.d/lxd.table" &>/dev/null tera -t "$MIAOU_BASEDIR/templates/nftables/lxd.table.j2" "$EXPANDED_CONF" -o "$MIAOU_CONFIGDIR/nftables.rules.d/lxd.table" &>/dev/null
fi fi
if ! diff -q "$MIAOU_CONFIGDIR/nftables.rules.d/lxd.table" /etc/nftables.rules.d/lxd.table; then
if ! diff -q "$MIAOU_CONFIGDIR/nftables.rules.d/lxd.table" /etc/nftables.rules.d/lxd.table &>/dev/null; then
sudo_required "reloading nftables" sudo_required "reloading nftables"
echo -n "reloading nftables..." echo -n "reloading nftables..."
sudo cp "$MIAOU_CONFIGDIR/nftables.rules.d/lxd.table" /etc/nftables.rules.d/lxd.table sudo cp "$MIAOU_CONFIGDIR/nftables.rules.d/lxd.table" /etc/nftables.rules.d/lxd.table
sudo systemctl reload nftables sudo systemctl reload nftables
PREFIX="" echo OK
PREFIX="" echo DONE
fi fi
} }

Loading…
Cancel
Save