forked from dd010101/vyos-jenkins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
4-uncron.sh
executable file
·90 lines (72 loc) · 2.15 KB
/
4-uncron.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env bash
source ./auto/helper-logic
# Clear the screen and print the header
PrintHeader
# Ensure we are running as root
EnsureRoot
# Ensure stage 3 is complete
EnsureStageIsComplete 3
#region Run Uncron script
cp ./auto/uncron-script.sh /var/lib/jenkins
chown jenkins:jenkins /var/lib/jenkins/uncron-script.sh
# This script builds the uncron package.
echo "Running uncron script as jenkins user..."
runuser -l jenkins -c "./uncron-script.sh"
echo
rm /var/lib/jenkins/uncron-script.sh > /dev/null 2>&1
#endregion
#region Copy uncron into sbin
if [ -f /usr/local/sbin/uncron ]; then
PrintOkIndicator "Uncron has already been installed."
else
function InstallUncron {
cp /var/lib/jenkins/uncron/_build/install/default/bin/uncron /usr/local/sbin/
}
Run "InstallUncron" \
"Installing Uncron..." \
"Failed to install Uncron." \
"Uncron has been installed."
fi
#endregion
#region Setup systemd service file
if [ -f /etc/systemd/system/uncron.service ]; then
PrintOkIndicator "SystemD service file has already been copied."
else
function CopySystemDServiceFile {
cp ./auto/uncron.service /etc/systemd/system
}
Run "CopySystemDServiceFile" \
"Copying SystemD service file..." \
"Failed to copy SystemD service file." \
"SystemD file has been copied."
fi
#endregion
#region Install Uncron Add
if [ -f /usr/local/bin/uncron-add ]; then
PrintOkIndicator "Uncron Add has already been installed."
else
function InstallUncronAdd {
cp ./auto/uncron-add /usr/local/bin
chmod +x /usr/local/bin/uncron-add
chmod +x /var/lib/jenkins/uncron/src/uncron-add
}
Run "InstallUncronAdd" \
"Installing Uncron Add..." \
"Failed to install Uncron Add." \
"Uncron Add has been installed."
fi
#endregion
#region Uncron config
if [ ! -f /etc/uncron.conf ]; then
touch /etc/uncron.conf
fi
#endregion
# Reload daemons.
systemctl daemon-reload > /dev/null 2>&1
# Ensure uncron service is enabled.
systemctl enable --now uncron.service > /dev/null 2>&1
echo
echo "Part 4 of the installer is now done."
echo "Please run part five (5-docker-jobs.sh) to set up the vyos build container jobs."
# Create marker file
CreateMarkerFile 4