From 6b7a50147a79267b14b65ea913ea0a19143acddb Mon Sep 17 00:00:00 2001 From: Alan O'Cull Date: Sat, 31 Aug 2024 11:06:27 -0400 Subject: [PATCH] Create setup script --- Makefile | 10 ++++++++++ setup/setup.py | 3 +++ setup/setup.sh | 20 ++++++++++++++++++-- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 Makefile mode change 100644 => 100755 setup/setup.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8b68795 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +.PHONY: clean setup all + +all: clean setup + +clean: + @rm -rf workspace/ + +setup: + @mkdir -p workspace/ + @./setup/setup.sh Blender4.2 blender-4.2.1-linux-x64.tar.xz diff --git a/setup/setup.py b/setup/setup.py index 982f0fc..1cb7cac 100644 --- a/setup/setup.py +++ b/setup/setup.py @@ -7,3 +7,6 @@ render_api = 'OPTIX' # NONE, CUDA, OPTIX, HIP, ONEAPI bpy.context.preferences.addons["cycles"].preferences.compute_device_type = render_api bpy.ops.wm.save_userpref() + +# Exit blender now that we're done +bpy.ops.wm.quit_blender() diff --git a/setup/setup.sh b/setup/setup.sh old mode 100644 new mode 100755 index 2c775c7..0680fa3 --- a/setup/setup.sh +++ b/setup/setup.sh @@ -1,3 +1,19 @@ +TARBALL=$2 +DIRECTORY="workspace/${TARBALL%.tar.xz}" +BINARY=$DIRECTORY/blender +SCRIPTS=$(pwd)/setup +echo $TARBALL - $DIRECTORY - $BINARY - $SCRIPTS -# Download blender from URL and write it to workspace -wget https://download.blender.org/release/$1/$2 -O workspace/$2 +# Create directory for writing +mkdir -p workspace/ +# Ensure blender workspace does not exist +rm -rf workspace/$DIRECTORY/ + +# Download blender from URL and write it to workspacem and extract the tarball +wget https://download.blender.org/release/$1/$TARBALL -O workspace/$TARBALL +tar -xf workspace/$TARBALL -C workspace/ + +# Export binary location and perform setup +export blender=workspace/$BINARY +echo | whereis blender +blender -b -P $SCRIPTS/setup.py