mirror of
https://github.com/ryantm/nixpkgs-update.git
synced 2024-12-17 08:21:44 +03:00
make up.sh work again if called by itself
This commit is contained in:
parent
11ae3a207d
commit
aebd678648
18
setup-nixpkgs.sh
Executable file
18
setup-nixpkgs.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euxo pipefail
|
||||
|
||||
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
|
||||
|
||||
export NIXPKGS
|
||||
|
||||
cd "$NIXPKGS"
|
25
up.sh
25
up.sh
@ -1,13 +1,23 @@
|
||||
#! /usr/bin/env bash
|
||||
#!/usr/bin/env bash
|
||||
set -euxo pipefail
|
||||
|
||||
NIX_PATH=nixpkgs="$(pwd)"
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$SCRIPT_DIR/setup-nixpkgs.sh"
|
||||
|
||||
NIX_PATH=nixpkgs="$NIXPKGS"
|
||||
export NIX_PATH
|
||||
|
||||
PACKAGE_NAME=$1
|
||||
OLD_VERSION=$2
|
||||
NEW_VERSION=$3
|
||||
OK_TO_PR_AT=$4
|
||||
|
||||
if [ "$#" -eq 4 ]
|
||||
then
|
||||
OK_TO_PR_AT=$4
|
||||
else
|
||||
OK_TO_PR_AT="0"
|
||||
fi
|
||||
|
||||
BRANCH_NAME="auto-update/$1"
|
||||
|
||||
@ -20,7 +30,12 @@ function cleanup {
|
||||
|
||||
function error_exit {
|
||||
cleanup
|
||||
echo "$(date -Iseconds) $1" >&3
|
||||
if ( >&3 ) 2> /dev/null
|
||||
then
|
||||
echo "$(date -Iseconds) $1" >&3
|
||||
else
|
||||
echo "$(date -Iseconds) $1"
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
@ -148,7 +163,7 @@ nix build -f . "$ATTR_PATH" || error_exit "nix build failed."
|
||||
|
||||
RESULT=$(readlink ./result || readlink ./result-bin || error_exit "Couldn't find result link.")
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
|
||||
CHECK_RESULT="$("$SCRIPT_DIR"/check-result.sh "$RESULT" "$NEW_VERSION")"
|
||||
|
||||
|
17
ups.sh
17
ups.sh
@ -1,4 +1,4 @@
|
||||
#! /usr/bin/env bash
|
||||
#!/usr/bin/env bash
|
||||
set -euxo pipefail
|
||||
|
||||
LOG_FILE=~/.nix-update/ups.log
|
||||
@ -12,20 +12,7 @@ export GITHUB_TOKEN
|
||||
|
||||
ARGUMENTS=$(cat packages-to-update.txt)
|
||||
|
||||
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"
|
||||
|
||||
export DRY_RUN=true
|
||||
source "$SCRIPT_DIR/setup-nixpkgs.sh"
|
||||
|
||||
echo "
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user