1#!/bin/bash 2 3# change to the install source directory 4cd "$( dirname "$( type -p $0 )" )" 5 6if ! [ -f bin/openscad -a -d lib/openscad -a -d examples -a -d libraries ]; then 7 echo "Error: Can't change to install source directory!" >&2 8 exit 1 9fi 10 11echo "This will install openscad. Please enter the install prefix" 12echo "or press Ctrl-C to abort the install process:" 13read -p "[/usr/local]: " prefix 14 15if [ "$prefix" = "" ]; then 16 prefix="/usr/local" 17fi 18 19if [ ! -d "$prefix" ]; then 20 echo; echo "Install prefix \`$prefix' does not exist. Press ENTER to continue" 21 echo "or press Ctrl-C to abort the install process:" 22 read -p "press enter to continue> " 23fi 24 25mkdir -p "$prefix"/{bin,lib/openscad,share/openscad/examples,share/openscad/libraries} 26 27if ! [ -w "$prefix"/bin/ -a -w "$prefix"/lib/openscad -a -w "$prefix"/share/openscad ]; then 28 echo "You does not seam to have write permissions for prefix \`$prefix'!" >&2 29 echo "Maybe you should have run this install script using \`sudo'?" >&2 30 exit 1 31fi 32 33echo "Copying application wrappers..." 34cp -rv bin/. "$prefix"/bin/ 35 36echo "Copying application..." 37cp -rv lib/. "$prefix"/lib/ 38 39echo "Copying examples..." 40cp -rv examples/. "$prefix"/share/openscad/examples/ 41 42echo "Copying libraries..." 43cp -rv libraries/. "$prefix"/share/openscad/libraries/ 44 45echo "Copying support files..." 46cp -rv share/. "$prefix"/share/ 47 48echo "Installation finished. Have a nice day." 49