From 22291cd795606a73226f3c7b0acff65bdbbf3f24 Mon Sep 17 00:00:00 2001 From: Andrew Tribick Date: Tue, 28 Dec 2021 15:22:11 +0100 Subject: [PATCH] Add PowerShell and sh scripts to clone/update content directory --- support/UpdateContent.ps1 | 19 +++++++++++++++++++ support/updatecontent.sh | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 support/UpdateContent.ps1 create mode 100755 support/updatecontent.sh diff --git a/support/UpdateContent.ps1 b/support/UpdateContent.ps1 new file mode 100755 index 000000000..398b4b6a8 --- /dev/null +++ b/support/UpdateContent.ps1 @@ -0,0 +1,19 @@ +$ScriptDir = Split-Path $MyInvocation.MyCommand.Path -Parent +$ScriptDir = Split-Path $ScriptDir -Parent +Push-Location $ScriptDir +if (-not (Test-Path "content")) +{ + git clone --depth 1 "https://github.com/CelestiaProject/CelestiaContent.git" -b master "content" +} +elseif (Test-Path "content" -PathType Container) +{ + Set-Location content + git fetch --depth 1 origin master + git reset --hard origin/master +} +else +{ + Write-Error "content exists and is not a directory" +} + +Pop-Location diff --git a/support/updatecontent.sh b/support/updatecontent.sh new file mode 100755 index 000000000..7c8385449 --- /dev/null +++ b/support/updatecontent.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +scripthome=$(dirname "$0" | while read a; do cd "$a" && pwd && break; done) +oldpath=$(pwd) +cd "$scripthome/.." + +if [ ! -e "content" ] +then + git clone --depth 1 "https://github.com/CelestiaProject/CelestiaContent.git" -b master content +elif [ -d "content" ] +then + cd content + git fetch --depth 1 origin master + git reset --hard origin/master +else + >&2 echo "content exists and is not a directory" +fi + +cd "$oldpath"