2018-03-22 07:53:38 +03:00
|
|
|
#!/usr/bin/env bash
|
2018-02-26 04:17:42 +03:00
|
|
|
set -euxo pipefail
|
|
|
|
|
|
|
|
LOG_FILE=~/.nix-update/ups.log
|
2018-03-17 17:57:57 +03:00
|
|
|
mkdir -p "$(dirname $LOG_FILE)"
|
2018-02-26 04:17:42 +03:00
|
|
|
touch $LOG_FILE
|
|
|
|
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
2018-03-18 08:04:34 +03:00
|
|
|
GITHUB_TOKEN="$(cat "$SCRIPT_DIR"/github_token.txt)"
|
|
|
|
export GITHUB_TOKEN
|
|
|
|
|
2018-03-20 07:00:52 +03:00
|
|
|
ARGUMENTS=$(cat packages-to-update.txt)
|
2018-02-26 04:17:42 +03:00
|
|
|
|
2018-03-22 07:53:38 +03:00
|
|
|
source "$SCRIPT_DIR/setup-nixpkgs.sh"
|
2018-03-18 08:04:34 +03:00
|
|
|
|
2018-03-14 20:06:37 +03:00
|
|
|
echo "
|
|
|
|
|
|
|
|
$(date -Iseconds) New run of ups.sh" >> $LOG_FILE
|
2018-02-26 04:17:42 +03:00
|
|
|
|
2018-03-20 08:37:51 +03:00
|
|
|
OK_TO_PR_AT=0
|
2018-02-26 04:17:42 +03:00
|
|
|
IFS=$'\n'
|
|
|
|
for a in $ARGUMENTS
|
|
|
|
do
|
|
|
|
unset IFS
|
2018-03-15 08:19:40 +03:00
|
|
|
echo "$(date -Iseconds) $a" >> $LOG_FILE
|
2018-03-20 08:37:51 +03:00
|
|
|
if eval "$SCRIPT_DIR/up.sh $a $OK_TO_PR_AT 3>>$LOG_FILE"
|
2018-02-26 04:17:42 +03:00
|
|
|
then
|
2018-03-15 08:19:40 +03:00
|
|
|
echo "$(date -Iseconds) SUCCESS" >> $LOG_FILE
|
2018-03-20 08:37:51 +03:00
|
|
|
OK_TO_PR_AT=$(date +%s -d "+15 minutes")
|
2018-02-26 04:17:42 +03:00
|
|
|
else
|
2018-03-15 08:19:40 +03:00
|
|
|
echo "$(date -Iseconds) FAIL" >> $LOG_FILE
|
2018-02-26 04:17:42 +03:00
|
|
|
fi
|
|
|
|
done
|