forked from openbroadcaster/obplayer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdater
More file actions
executable file
·36 lines (30 loc) · 724 Bytes
/
updater
File metadata and controls
executable file
·36 lines (30 loc) · 724 Bytes
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
#!/usr/bin/env bash
set -e
# log message
function log() {
message=$1
#print to the shell incase someone ran this manually.'
DATE=$(date)
echo "$DATE: $message"
echo "$DATE: $message" > $LOG_FILE
}
function run_upgrade() {
log "*** Upgrading OS packages... ***"
apt upgrade -y
log "*** OS updating complete. System should reboot now. ***"
#reboot
}
UPDATE_FILE="/tmp/obplayer.update"
LOG_FILE=$1
if [[ -f "$UPDATE_FILE" ]]; then
log "*** Checking for OS updates... ***"
DATA=$(apt update)
# echo $DATA
# check for updates.
if [[ $DATA =~ "packages can be upgraded" ]]; then
run_upgrade
fi
log "*** Exiting and removing $UPDATE_FILE ***"
rm $UPDATE_FILE
fi
log "*** Exiting... ***"