-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathliar-update-software
More file actions
executable file
·58 lines (45 loc) · 1.58 KB
/
liar-update-software
File metadata and controls
executable file
·58 lines (45 loc) · 1.58 KB
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
#!/usr/bin/env bash
#
# liar update script for liar-software
#
# Maven, Java and optionally GraalVM should be installed
#
function get_last_updates() {
. ${LIAR_SOFTWARE_FILE}
last_updates_str=""
for last_update in "${last_updates[@]}"; do
last_updates_str="${last_updates_str} ${last_update}"
done
echo "${last_updates_str}"
}
set -o errexit
LIAR_REPOSITORY_URL=git@framagit.org:grumpyf0x48/liar.git
LIAR_UPDATE_REPOSITORY_URL=git@github.com:linux-installer-archives/update-software.git
LIAR_USER=liar-update
if [ $# -lt 1 ]; then
echo "Usage $0 [daily | weekly | monthly] [update_software | update_software_native]" >&2
exit 1
fi
LIAR_PERIODICITY="$1"
LIAR_UPDATE_TARGET="${2:-"update_software"}"
# Clone repositories
# To trust git server certificate
export GIT_SSL_NO_VERIFY=true
# To avoid 'git clone' to cd to /root
cd /tmp
LIAR_REPOSITORY=$(mktemp -d)
git clone "${LIAR_REPOSITORY_URL}" "${LIAR_REPOSITORY}"
LIAR_UPDATE_REPOSITORY=$(mktemp -d)
git clone "${LIAR_UPDATE_REPOSITORY_URL}" "${LIAR_UPDATE_REPOSITORY}"
# Run update
make -C "${LIAR_UPDATE_REPOSITORY}" LIAR_REPOSITORY="${LIAR_REPOSITORY}" LIAR_PERIODICITY="${LIAR_PERIODICITY}" "${LIAR_UPDATE_TARGET}"
# Commit changes to repository
LIAR_SOFTWARE_FILE=config/liar-software
cd "${LIAR_REPOSITORY}"
if git status --porcelain ${LIAR_SOFTWARE_FILE} | grep ${LIAR_SOFTWARE_FILE}; then
git config user.name "${LIAR_USER}[bot]"
git config user.email "${LIAR_USER}@$(hostname)"
git pull
git commit -a -m "chore(software): ${LIAR_PERIODICITY^} URL update:$(get_last_updates)"
git push
fi