nixpkgs-update/ups.sh

43 lines
876 B
Bash
Raw Normal View History

2018-02-26 04:17:42 +03:00
#! /usr/bin/env bash
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-04 17:58:53 +03:00
ARGUMENTS=""
2018-02-26 04:17:42 +03:00
NIXPKGS=$HOME/.cache/nixpkgs
if ! [ -d "$NIXPKGS" ]
then
hub clone nixpkgs $NIXPKGS # requires that user has forked nixpkgs
cd $NIXPKGS
git remote add upstream https://github.com/NixOS/nixpkgs
git fetch upstream
git fetch origin staging
git fetch upstream staging
fi
cd $NIXPKGS
2018-03-04 17:58:53 +03:00
export DRY_RUN=true
echo "
$(date -Iseconds) New run of ups.sh" >> $LOG_FILE
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
if eval "$SCRIPT_DIR/up.sh $a 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
sleep 900
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