#!/bin/bash

TARGET_USER=$(id -un 1000)
TARGET_HOME=$(getent passwd 1000 | cut -d: -f6)
echo $TARGET_USER  >> /tmp/potato.log
echo "Starting Magic!\n" >> /tmp/potato.log
systemctl enable --now qemu-guest-agent
echo "Downlaoding the thingy that will do the thing to make it pretty."  >> /tmp/potato.log
sudo -u "$TARGET_USER" wget -O /tmp/cloud-init.tar.gz  http://web.kiwi/cloud-init.tar.gz
echo "The thingy was downlaoded, now it's time to backup some shit.." >> /tmp/potato.log
sudo -u "$TARGET_USER" mv $TARGET_HOME/.bashrc $TARGET_HOME/.bashrc.bak
echo "Shit backed up, making things pretty." >> /tmp/potato.log
sudo -u "$TARGET_USER" tar -xf /tmp/cloud-init.tar.gz -C $TARGET_HOME/
echo "Done, everything is pretty!" >> /tmp/potato.log
