Suitable binary tar.bz2 s include those from blender.community/c/graphicall/
If python3.7 is present, most of the bundled python is removed, which blender is tricked into using via links. If not, bundled python is included.
the bundled python is now at 3.10 (slackware is at 3.9) so bundled python is included.
Opengl stuff is also left out.
Unused language packs are also removed.
A module is here: update-blender-20230116.xzm md5sum: d40f5512bc520c8c1b7ced6973b4f7fe
contents:
Code: Select all
update-blender-20221023
└── usr
└── local
└── bin
└── update-blender
options are: -h (shows usage info)
-v (shows version number(date))
and -d (which makes all build operations done in current directory instead of /tmp(must be POSIX ie.not fat or ntfs... useful for limited RAM)
update-blender:
Code: Select all
#!/bin/bash
## update-blender
## A script to make a module for porteus-5.0 from the latest stable blender binary release
## or from a binary tar.xz placed in /tmp or a (POSIX) dir of your choice
## suitable binary tar.xz include the development builds from builder.blender.org/download/ or blender.community/c/graphicall/
##
## Use at your own risk!! Possible negative outcomes: wasted bandwidth and an useless module. The puppies may survive.
##
## by ncmprhnsbl forum.porteus.org
SVER=20230116
# Source porteus-functions
. /usr/share/porteus/porteus-functions
get_colors
txtbld=$(tput bold)
txtred=${txtbld}$(tput setaf 1)
txtgreen=${txtbld}$(tput setaf 2)
txtwhite=${txtbld}$(tput setaf 7)
txtcyan=${txtbld}$(tput setaf 6)
rst=$(tput sgr0)
function bold(){ echo -e $txtbld "$1" $rst; }
function green() { echo -e $txtgreen "$1" $rst; }
function red(){ echo $txtred "$1" $rst; }
function cyan(){ echo $txtcyan "$1" $rst; }
saypass(){ echo "[${txtgreen}PASS$rst] $1"; }
sayfail(){ echo "[${txtred}FAIL$rst] $1"; }
# Check for root
if [ `whoami` != "root" ]; then
if [ `whoami` != "root" ]; then
echo "Please enter root's password below"
su - -c "update-blender $1"
exit
fi
fi
## Variables
URL1=https://download.blender.org/release/
URL2=https://builder.blender.org/download/
PORTVER=`cat /etc/porteus-version | cut -d- -f2`
PYTHVER=`/usr/bin/python --version | cut -d" " -f2 | awk -F. '{print$1$2}'`
# functions set work directory(default is /tmp) to current work directory
set_tmp() {
WRKDIR=/tmp
}
set_pwd() {
WRKDIR=`pwd`
}
# echo usage
show_help() {
echo " update-blender: "
echo " This script will download the latest stable release of blender "
echo " and create a porteus module. "
echo " A predownloaded tarball can also be used by placing it in /tmp"
echo " or your chosen directory(-d) which needs to be POSIX compatible."
echo
echo " options: -d : do operations in the present directory, instead of /tmp . "
echo " -h : show this usage. "
echo " -v : show script version. "
}
# echo script version
show_version() {
echo " update-blender version: $SVER "
}
while getopts ":-d:-h:-v:" o; do
case "$1" in
-d)
set_pwd;;
-h)
show_help
exit 0;;
-v)
show_version
exit 0;;
*)
show_help
exit 1;;
esac
done
case "$1" in
"")
set_tmp;;
esac
# tell us where the work will be done
echo "Work will be done in: $WRKDIR "
## Check if there's enough working space
[ `df -l --output=avail $WRKDIR | tail -1` -lt 384000 ] && { red "There's not enough space to run this script"; exit 1; }
case `uname -m` in
x86_64)
ARCH=x86_64
SUFFIX=x64
SARCH=x86_64
;;
*)
ARCH=i686
SUFFIX=
SARCH=i586
;;
esac
## functions for setting locale
array_menu(){
echo
echo "$1"
echo "$2"
select LOCALE in ${ARESULT[@]}; do
if [ -z "$LOCALE" ]; then
bold "English locale chosen." && echo
else
bold "$LOCALE locale chosen"
fi
break
done
}
get_locale(){
# Set locales in array
for a in ab ar ca cs de eo en-US es es_ES eu fa fr ha he hi hr hu id it ja ko ky nl pl pt pt-BR ru sk sr sr@latin sv th tr uk vi zh-CN zh-TW; do
ARESULT+=( $a )
done
array_menu "Choose a locale from the list."
unset ARESULT
}
array_menu2(){
echo
echo "$1"
echo "$2"
select CHOICE1 in ${RESULT2[@]}; do
if [ -z "$CHOICE1" ]; then
bold "? release chosen." && echo
else
bold "$CHOICE1 release chosen"
fi
break
done
}
get_release_type(){
array_menu2 "Please choose a release from the menu."
case $CHOICE1 in
stable) URL=$URL1 BPY=310;;
daily-alpha) URL=$URL2 BPY=310;;
daily-beta) URL=$URL2 BPY=310;;
*)
echo "Invalid choice"
$FUNCNAME
;;
esac
}
cleanup(){
echo
rm -rf $TARG
[ -d $TMPDIR ] && rm -rf $TMPDIR
exit
}
trap cleanup SIGHUP SIGINT SIGTERM
## (soft)checksum check
checksum () {
if [ -z $CHOICE ]; then
echo "Verifying download integrity.."
echo "Server : $SUM1"
echo "Download: $SUM2"
if [ "$SUM1" = "$SUM2" ]; then
echo "Download verified."
else
echo "Warnig: Integrity check failed."
echo "Continuing anyway.. if there's a problem, this could be it."
fi
fi
}
## Check for tarball in $WRKDIR
if [ `find ${WRKDIR}/blender* 2>/dev/null | wc -l` -ge 1 ]; then
# Make sure it is a tarball
cfile=( `find $WRKDIR/blender-*.tar.xz 2>/dev/null | awk -F/ '{print$NF}' ` )
if [ ${#cfile[@]} -gt 0 ]; then
RESULT=${cfile[@]}
echo
green "A blender tarball was found in $WRKDIR"
echo " We will use this archive to create blender."
menu_from_array "Choose the blender file you want to process."
echo "CHOICE:$txtgreen $CHOICE $rst"
fi
fi
TMPDIR=$WRKDIR/.blen.$$
CWD=`pwd`
## if x86_64 offer a choice of stable or daily build, if not , don't
if [ -z $CHOICE ]; then
if [ "$ARCH" = "x86_64" ]; then
RESULT2+=( 'stable' 'daily-alpha' 'daily-beta' )
get_release_type
else
echo "Unfortunately, Blender Foundation no longer supplies 32 bit binaries. :("
cleanup
fi
fi
## get relevent version info
if [ -z $CHOICE ]; then
echo " Fetching latest Blender version info.."
if [ "$CHOICE1" = "stable" ]; then
TVER=`lynx -dump --nonumbers --listonly $URL | grep -o "[0-9].[0-9]" | sort | tail -n1`
LVER=`lynx -dump --nonumbers --listonly $URL/Blender$TVER | grep "linux" | sort | tail -n1 | cut -d"-" -f2`
VER1=${LVER%-*}
VER=${VER1%.*}
echo " Latest version is:" $txtgreen "$LVER" $rst
echo " python is $BPY"
elif [ "$CHOICE1" = "daily-alpha" ]; then
LVER=`lynx -dump --nonumbers --listonly $URL | grep "linux" | sort | tail -n1 | cut -d"-" -f2,3`
VER1=${LVER%-*}
VER=${VER1%.*}
echo " Latest version is:" $txtgreen "$LVER" $rst
echo " python is $BPY"
#echo " $VER "
elif [ "$CHOICE1" = "daily-beta" ]; then
LVER=`lynx -dump --nonumbers --listonly $URL | grep "linux" | grep "candidate" | sort | tail -n1 | cut -d"-" -f2,3`
VER1=${LVER%-*}
VER=${VER1%.*}
echo " Latest version is:" $txtgreen "$LVER" $rst
echo " python is $BPY"
fi
else
if [ "`tr -dc '-' <<< $CHOICE | wc -c`" = "5" ]; then
LVER=`cut -d"-" -f2,3 <<< $CHOICE`
VER=${LVER%-*}
echo " version is: $VER"
elif [ "`tr -dc '-' <<< $CHOICE | wc -c`" = "4" ]; then
LVER=`cut -d"-" -f2 <<< $CHOICE`
VER=${LVER%.*}
SRC=${CHOICE%.*.*}
echo " version is: $VER"
echo " src is : $SRC"
elif [ "`tr -dc '-' <<< $CHOICE | wc -c`" = "3" ]; then
LVER=`cut -d"-" -f2 <<< $CHOICE`
VER=${LVER%.*}
SRC=${CHOICE%.*.*}
echo " version is: $VER"
echo " src is : $SRC"
else
echo " Unable to get version info.. "
echo " The tarball's name does not conform to known parameters. "
echo " Exiting.."
exit 1
fi
fi
### some idea about 'rc' versions
#if [ `wc -m <<< $VER` -gt 4 ]; then
# cut -c 1-4 <<< $VER
#fi
## Determine glibc version supplied
#if [ -z $CHOICE ]; then
# if [ "$ARCH" = "x86_64" ]; then
# GLIBC="-glibc217";
# else
# GLIBC="-glibc224";
# fi
#elif [ -n "`grep -o "glibc" <<< $CHOICE`" ]; then
# GLIBC="-`awk -F"linux-" '{print$2}' <<< $CHOICE | cut -d- -f1`"
#else
# GLIBC=
#fi
if [ -z $CHOICE ]; then
read -p " Would you like to create a module of the latest version? [y/n]" -n 1 -r -s && echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then cleanup; fi
else
read -p " Would you like to continue with this tarball? [y/n]" -n 1 -r -s && echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then cleanup; fi
fi
get_locale
if [ -z $CHOICE ]; then
if [ "$URL" = "$URL1" ]; then
EXT="tar.xz"
TAR="blender-${LVER}-linux-${SUFFIX}.${EXT}"
SRC="blender-${LVER}-linux-${SUFFIX}"
DURL="${URL}Blender${VER}/${TAR}"
#VER2=`echo $VER | tr -d '.'`
SUM1=`lynx -dump --dont_wrap_pre $DURL/release${LVER//./}.md5 | grep $TAR | cut -d" " -f1`
elif [ "$URL" = "$URL2" ]; then
EXT="tar.xz"
TAR="blender-${LVER}-linux.${ARCH}-release.${EXT}"
SRC="blender-${LVER}-linux.${ARCH}-release"
fi
fi
## Create temp dir
[ ! -d $TMPDIR ] && mkdir -p $TMPDIR || rm -rf "${TMPDIR:?}"
## download choice or copy existing
if [ -z $CHOICE ]; then
if [ "$URL" = "$URL1" ]; then
download $DURL $TMPDIR
elif [ "$URL" = "$URL2" ]; then
download $URL/$TAR $TMPDIR
fi
else
cp -a $WRKDIR/$CHOICE $TMPDIR
fi
## Check that we have an archive in TMPDIR
if [ -z $CHOICE ]; then
if [ ! -f $TMPDIR/$TAR ]; then
echo
sayerror "File $TAR not found"
cleanup
fi
elif [ ! -f $TMPDIR/$CHOICE ]; then
echo
sayerror "File $CHOICE not found"
cleanup
fi
## checksum check
if [ -z "$URL" ] && [ "$URL" = "$URL1" ]; then
SUM2=`md5sum $TMPDIR/$TAR | cut -d" " -f1`
checksum
fi
## go to module build dir
cd $TMPDIR
if [ -z $CHOICE ]; then
tar xvf $TAR
else
tar xvf $CHOICE
fi
echo " Locale is $LOCALE"
#echo " version is $VER "
echo " Removing unwanted locales ..."
if [ "$LOCALE" != "en-US" ]; then
find $SRC/$VER/datafiles/locale -type f -name "*" | egrep -v "${LOCALE}" | xargs -i rm {}
else
rm -rvf $SRC/$VER/datafiles/locale
fi
chown -R root:root $SRC
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
echo "making build directories.."
mkdir -p $TMPDIR/build/usr/share/applications
mkdir -p $TMPDIR/build/usr/bin
#~ if [ "$BPY" = "37" ]; then
#~ if [ "$PYTHVER" = "37" ]; then
#~ mkdir -p $TMPDIR/build/usr/lib$SUFFIX/python3.7
#~ mkdir -p $TMPDIR/build/opt/blender-$VER/$VER/python
#~ else
#~ mkdir -p $TMPDIR/build/opt/blender-$VER/$VER
#~ fi
#~ elif [ "$BPY" = "39" ]; then
#~ if [ "$PYTHVER" = "39" ]; then
#~ mkdir -p $TMPDIR/build/usr/lib$SUFFIX/python3.9
#~ mkdir -p $TMPDIR/build/opt/blender-$VER/$VER/python
#~ else
#~ mkdir -p $TMPDIR/build/opt/blender-$VER/$VER
#~ fi
#~ fi
mkdir -p $TMPDIR/build/opt/blender-$VER/$VER
cd $TMPDIR/build
#echo " source is : $SRC"
echo " copying the files we want.."
[ -e $TMPDIR/$SRC/$VER/datafiles ] && cp -a $TMPDIR/$SRC/$VER/datafiles opt/blender-$VER/$VER/
[ -e $TMPDIR/$SRC/$VER/scripts ] && cp -a $TMPDIR/$SRC/$VER/scripts opt/blender-$VER/$VER/
[ -e $TMPDIR/$SRC/blender ] && cp -a $TMPDIR/$SRC/blender opt/blender-$VER/
cp -a $TMPDIR/$SRC/blender* opt/blender-$VER/
cp -a $TMPDIR/$SRC/*.txt opt/blender-$VER/
[ -e $TMPDIR/$SRC/readme.html ] && cp -a $TMPDIR/$SRC/readme.html opt/blender-$VER/
[ -e $TMPDIR/$SRC/icons ] && cp -a $TMPDIR/$SRC/icons opt/blender-$VER/
## don't use shipped libgl ..but alpha needs some libcycles stuff
#if [ `echo $SRC | grep "alpha"` ]; then
if [ -e $TMPDIR/$SRC/lib/libcycles_kernel_oneapi_aot.so ]; then
cp -a $TMPDIR/$SRC/lib opt/blender-$VER/
[ -e opt/blender-$VER/lib/mesa ] && rm -rf opt/blender-$VER/lib/mesa
fi
## move the .desktop to somewhere useful
[ -e opt/blender-$VER/blender.desktop ] && mv opt/blender-$VER/blender.desktop usr/share/applications/
## and make it use the icon provided in /opt/blender
[ -e usr/share/applications/blender.desktop ] && sed -i "/Icon=/ s+blender+/opt/blender-$VER/blender.svg+" usr/share/applications/blender.desktop
## use only the site-packages (porteus has the rest of python3.9) ..this is potentially messy if the user has some of these installed already...
## only do for python 3.9
#~ if [ "$BPY" = "39" ]; then
#~ if [ "$PYTHVER" = "39" ]; then
#~ [ -e $TMPDIR/$SRC/$VER/python/lib/python3.9/site-packages ] && cp -a $TMPDIR/$SRC/$VER/python/lib/python3.9/site-packages usr/lib$SUFFIX/python3.9/
#~ echo " linking some stuff so blender can find them.."
#~ ln -s /usr/lib$SUFFIX opt/blender-$VER/$VER/python/lib
#~ ln -s /usr/bin opt/blender-$VER/$VER/python/bin
#~ fi
#~ elif [ "$BPY" = "37" ]; then
#~ if [ "$PYTHVER" = "37" ]; then
#~ [ -e $TMPDIR/$SRC/$VER/python/lib/python3.7/site-packages ] && cp -a $TMPDIR/$SRC/$VER/python/lib/python3.7/site-packages usr/lib$SUFFIX/python3.7/
#~ echo " linking some stuff so blender can find them.."
#~ ln -s /usr/lib$SUFFIX opt/blender-$VER/$VER/python/lib
#~ ln -s /usr/bin opt/blender-$VER/$VER/python/bin
#~ fi
#~ fi
[ -e $TMPDIR/$SRC/$VER/python ] && cp -a $TMPDIR/$SRC/$VER/python opt/blender-$VER/$VER/
rm -rf opt/blender-$VER/$VER/python/lib/python3.10/config-3.10-x86_64-linux-gnu
## only do for python other than 3.9 or 3.7
#~ if [ "$BPY" = "39" ]; then
#~ if [ "$PYTHVER" != "39" ]; then
#~ [ -e $TMPDIR/$SRC/$VER/python ] && cp -a $TMPDIR/$SRC/$VER/python opt/blender-$VER/$VER/
#~ ## remove some unnecessary python bits
#~ rm -rf opt/blender-$VER/$VER/python/lib/python3.9/config-3.9m-x86_64-linux-gnu
#~ fi
#~ elif [ "$BPY" = "37" ]; then
#~ if [ "$PYTHVER" != "37" ]; then
#~ [ -e $TMPDIR/$SRC/$VER/python ] && cp -a $TMPDIR/$SRC/$VER/python opt/blender-$VER/$VER/
#~ ## remove some unnecessary python bits
#~ rm -rf opt/blender-$VER/$VER/python/lib/python3.7/config-3.7m-x86_64-linux-gnu
#~ fi
#~ fi
[ -e opt/blender-$VER/blender ] && ln -s /opt/blender-$VER/blender usr/bin/blender
cd ${WRKDIR}
echo " Making module"
dir2xzm $TMPDIR/build ${WRKDIR}/blender-${LVER}-${ARCH}-${LOCALE}.xzm
echo " Your module is ready at ${WRKDIR}"
echo " Please move it to somewhere safe.."
cleanup
Code: Select all
$ tree -L 5
.
├── opt
│ └── blender-2.81
│ ├── 2.81
│ │ ├── datafiles
│ │ │ ├── colormanagement
│ │ │ ├── fonts
│ │ │ ├── icons
│ │ │ └── studiolights
│ │ ├── python
│ │ │ ├── bin -> /usr/bin
│ │ │ └── lib -> /usr/lib64
│ │ └── scripts
│ │ ├── addons
│ │ ├── addons_contrib
│ │ ├── freestyle
│ │ ├── modules
│ │ ├── presets
│ │ ├── startup
│ │ ├── templates_osl
│ │ └── templates_py
│ ├── GPL-license.txt
│ ├── GPL3-license.txt
│ ├── LICENSE-bfont.ttf.txt
│ ├── LICENSE-bmonofont-i18n.ttf.txt
│ ├── LICENSE-droidsans.ttf.txt
│ ├── Python-license.txt
│ ├── blender
│ ├── blender-softwaregl
│ ├── blender-symbolic.svg
│ ├── blender-thumbnailer.py
│ ├── blender.svg
│ ├── copyright.txt
│ ├── icons
│ │ ├── scalable
│ │ │ └── apps
│ │ └── symbolic
│ │ └── apps
│ ├── jemalloc-license.txt
│ ├── ocio-license.txt
│ └── readme.html
└── usr
├── bin
│ └── blender -> /opt/blender-2.81/blender
├── lib64
│ └── python3.7
│ └── site-packages
│ ├── certifi
│ ├── chardet
│ ├── idna
│ ├── libextern_draco.so
│ ├── numpy
│ ├── requests
│ └── urllib3
└── share
└── applications
└── blender.desktop