-
Notifications
You must be signed in to change notification settings - Fork 1
/
go.sh
executable file
·50 lines (44 loc) · 1.33 KB
/
go.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
set -e
cd "${0%/*}"
URL=https://github.com/mattiasb/MachineSetup.git
BRANCH=master
REPO_DIR="/tmp/MachineSetup"
# Install ansible
if ! command -v ansible >/dev/null; then
sudo dnf install -y ansible
fi
# Clone the code
if [ ! -d "${REPO_DIR}" ]; then
mkdir -p "$(dirname "${REPO_DIR}")"
git clone --branch "${BRANCH}" "${URL}" "${REPO_DIR}"
fi
cd "${REPO_DIR}"
git branch --set-upstream-to="origin/${BRANCH}" "${BRANCH}"
git config user.name "Mattias Bengtsson"
git config user.email "[email protected]"
git pull --rebase
# Set hostname
# TODO: Move this to Ansible
if [[ "$(systemd-detect-virt)" == kvm ]]; then
sudo hostnamectl set-hostname machinesetup-test
sudo dnf install -y openssh-server
sudo systemctl enable --now sshd
sudo systemctl restart avahi-daemon
else
case "$(sudo cat /sys/devices/virtual/dmi/id/product_uuid)" in
94a01d4c-2baa-11b2-a85c-cbb86a8dd428)
sudo hostnamectl set-hostname mattiasb-lenovo-x13
;;
5403a9cc-1fd7-11b2-a85c-8f21df61ca6a)
sudo hostnamectl set-hostname mattiasb-lenovo-l15
;;
1afaa71f-393e-11e8-9379-8c164560bb35)
sudo hostnamectl set-hostname mattiasb-lenovo-yoga920
;;
*)
echo Unknown hardware!
exit 3
esac
fi
./site.yml -v