diff --git a/tools/linux_packaging/build b/tools/linux_packaging/build index 1c80f8d45b..ab2ed452cc 100755 --- a/tools/linux_packaging/build +++ b/tools/linux_packaging/build @@ -5,6 +5,11 @@ . ./buildenv # script for pulling together a Linux app bundle. +# +# This will create a bundle for a single architecture. +# Execute this scirpt on both x86 and x86_64 and then use +# package to merge the 2 bundles into a final package with the +# installer. SAE= MIXBUS= @@ -14,6 +19,7 @@ STRIP=1 PRINT_SYSDEPS= WITH_NLS= EXTERNAL_JACK= +VENDOR=Ardour ; if [ $# -eq 0 ] ; then echo "" @@ -48,6 +54,7 @@ while [ $# -gt 0 ] ; do WITH_LADSPA=; STRIP= ; APPNAME=Mixbus ; + VENDOR=Harrison ; shift ;; --public) WITH_NLS=1 ; @@ -166,6 +173,7 @@ mkdir -p $Locale mkdir -p $Surfaces mkdir -p $Panners mkdir -p $Shared/templates +mkdir -p $Shared/doc # maybe set variables ENVIRONMENT=environment @@ -273,9 +281,9 @@ GTKROOT=`pkg-config --libs-only-L gtk+-2.0 | sed -e "s/-L//" -e "s/[[:space:]]// if [ ! -z "$GTKROOT" ]; then echo "Found GTKROOT using pkg-config" elif [ -d /usr/lib/gtk-2.0 ]; then - GTKROOT="/usr/lib/gtk-2.0" + GTKROOT="/usr/lib" elif [ -d /usr/local/lib/gtk-2.0 ]; then - GTKROOT="/usr/local/lib/gtk-2.0" + GTKROOT="/usr/local/lib" else echo "" echo "!!! ERROR !!! - Unable to locate gtk-2.0 directory. Packager will exit" @@ -288,7 +296,7 @@ versionDir=`ls ${GTKROOT}/gtk-2.0/ | grep "[0-9]*\.[0-9]*\.[0-9]*"` num=0 for name in $versionDir ; do - let "num += 1" + num=$(($num + 1)) done if [ $num -eq 1 ]; then @@ -307,9 +315,9 @@ PANGOROOT=`pkg-config --libs-only-L pango | sed -e "s/-L//" -e "s/[[:space:]]//g if [ ! -z "$PANGOROOT" ]; then echo "Found PANGOROOT using pkg-config" elif [ -d /usr/lib/pango ]; then - PANGOROOT="/usr/lib/pango" + PANGOROOT="/usr/lib" elif [ -d /usr/local/lib/pango ]; then - PANGOROOT="/usr/local/lib/pango" + PANGOROOT="/usr/local/lib" else echo "" echo "!!! ERROR !!! - Unable to locate pango directory. Packager will exit" @@ -322,7 +330,7 @@ versionDir=`ls ${PANGOROOT}/pango/ | grep "[0-9]*\.[0-9]*\.[0-9]*"` num=0 for name in $versionDir ; do - let "num += 1" + num=$(($num + 1)) done if [ $num -eq 1 ]; then @@ -361,7 +369,7 @@ if [ -z ${GDKPIXBUFLIB} ]; then num=0 for name in $versionDir ; do - let "num += 1" + num=$(($num + 1)) done if [ $num -eq 1 ]; then @@ -449,7 +457,7 @@ while [ true ] ; do fi done depCheckedList[$checkIdx]=$file - let "checkIdx += 1" + checkIdx=$(($checkIdx + 1)) # do not include libjack deps=`LD_LIBRARY_PATH=$OURLIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ldd $file | awk '{print $3}'` @@ -557,39 +565,46 @@ for svndir in `find $APPDIR -name .svn -type d`; do rm -rf $svndir done -#Sanity Check file -if [ -e ../sanity_check/sanityCheck ]; then - cp ../sanity_check/sanityCheck $APPDIR -else - echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete" - exit 1 -fi - # -# and now ... the final package +# Add any documentation to the top level of the package # if [ x$SAE != x ] ; then # SAE packaging - echo "Creating SAE packaging directory" - cp HowToInstallArdourSAE.pdf "$APPDIR/How To Install Ardour SAE.pdf" - cp SAE-de-keypad.pdf "$APPDIR/Ardour SAE Shortcuts (keypad).pdf" - cp SAE-de-nokeypad.pdf "$APPDIR/Ardour SAE Shortcuts.pdf" + echo "Adding SAE documentation" + cp HowToInstallArdourSAE.pdf "$Shared/doc/How To Install Ardour SAE.pdf" + cp SAE-de-keypad.pdf "$Shared/doc/Ardour SAE Shortcuts (keypad).pdf" + cp SAE-de-nokeypad.pdf "$Shared/doc/Ardour SAE Shortcuts.pdf" elif [ x$MIXBUS != x ] ; then # Mixbus packaging - echo "Creating Mixbus packaging directory" - cp MixBus_Install_QuickStart.pdf "$APPDIR/Mixbus Install & Quick Start Guide.pdf" + echo "Adding Mixbus documentation" + cp MixBus_Install_QuickStart.pdf "$Shared/doc/Mixbus Install & Quick Start Guide.pdf" if [ -x $EXTERNAL_JACK != x ] ; then cp $EXTERNAL_JACK $PRODUCT_PKG_DIR fi fi +# +# Add the uninstaller +# +APP_VER_NAME=${APPNAME}-${release_version}_${svn_version} +sed -e "s/%REPLACE_PGM%/${APPNAME}/" -e "s/%REPLACE_VENDOR%/${VENDOR}/" -e "s/%REPLACE_VERSION%/${release_version}/" -e "s/%REPLACE_BUILD%/${svn_version}/" < uninstall.sh.in > $APPBIN/${APP_VER_NAME}.uninstall.sh +chmod a+x $APPBIN/${APP_VER_NAME}.uninstall.sh + +#Sanity Check file +if [ -e ../sanity_check/sanityCheck ]; then + cp ../sanity_check/sanityCheck $APPBIN +else + echo "!!!ERROR !!! sanityCheck program is missing. packager will exit without being complete" + exit 1 +fi + echo "Building tarball ..." rm -f $APPDIR.tar.bz2 diff --git a/tools/linux_packaging/stage2.run b/tools/linux_packaging/stage2.run index 5c0f0dfa71..197c75ce18 100755 --- a/tools/linux_packaging/stage2.run +++ b/tools/linux_packaging/stage2.run @@ -14,17 +14,9 @@ PGM_NAME="Ardour" PGM_VENDOR="Ardour" PGM_EXEC_FILE="ardour2" -INSTALL_DEST_BASE="/usr/local/bin" +INSTALL_DEST_BASE="/opt" -#### Derived Variables #### PGM_NAME_LOWER=$(echo $PGM_NAME | tr '[:upper:]' '[:lower:]') -ICON_NAME="${PGM_VENDOR}-${PGM_NAME}" -MENU_FILE="${PGM_VENDOR}-${PGM_NAME}.desktop" -DESKTOP_LINK_FILE="${PGM_NAME}.desktop" - -PGM_EXEC_PATH="${INSTALL_DEST_BASE}/${PGM_NAME}/bin/${PGM_EXEC_FILE}" -ICON_PATH="${INSTALL_DEST_BASE}/${PGM_NAME}/etc/icons" -MENU_FILE_PATH="${INSTALL_DEST_BASE}/${PGM_NAME}/${MENU_FILE}" #### Global Variables #### HAS_XDG="T" @@ -107,6 +99,10 @@ SystemInstall () # Main ######################################################################## +echo "" +echo "Welcome to the ${PGM_NAME} installer" +echo "" + ############## # Check sudo ############## @@ -131,12 +127,10 @@ case `uname -m` in i[3456789]86|x86|i86pc) echo "Architecture is x86" ARCH='x86' - BUNDLE_DIR=${PGM_NAME}_${ARCH}-* ;; x86_64|amd64|AMD64) echo "Architecture is x86_64" ARCH='x86_64' - BUNDLE_DIR=${PGM_NAME}_${ARCH}-* ;; *) echo "" @@ -149,7 +143,8 @@ esac # untar the correct bundle for us to install echo "Unpacking bundle for $ARCH" -tar -xjf ${BUNDLE_DIR}.tar.bz2 +tar -xjf ${PGM_NAME}_${ARCH}-*.tar.bz2 +BUNDLE_DIR=$(basename `find -maxdepth 1 -type d -name "${PGM_NAME}_${ARCH}-*"`) ####################### @@ -214,49 +209,67 @@ then exit 1 fi +################################ +# Setup derived variables +################################ +PGM_VERSION=$(echo ${BUNDLE_DIR} | awk 'BEGIN { FS = "-" } ; { print $2 }' | awk 'BEGIN { FS = "_"} ; { print $1}') +PGM_BUILD=$(echo ${BUNDLE_DIR} | awk 'BEGIN { FS = "-" } ; { print $2 }' | awk 'BEGIN { FS = "_"} ; { print $2}') +PGM_FULL_NAME="${PGM_NAME}-${PGM_VERSION}_${PGM_BUILD}" + +ICON_NAME="${PGM_VENDOR}-${PGM_NAME}_${PGM_VERSION}" #no dash since it seperates vendor from program +MENU_FILE="${PGM_VENDOR}-${PGM_NAME}_${PGM_VERSION}.desktop" #no dash since it seperates vendor from program +DESKTOP_LINK_FILE="${PGM_NAME}_${PGM_VERSION}.desktop" + +PGM_EXEC_PATH="${INSTALL_DEST_BASE}/${PGM_FULL_NAME}/bin/${PGM_EXEC_FILE}" +ICON_PATH="${INSTALL_DEST_BASE}/${PGM_FULL_NAME}/etc/icons" +MENU_FILE_PATH="${INSTALL_DEST_BASE}/${PGM_FULL_NAME}/share" + ################################ # Install bundle and Menu/Link ################################ -# uninstall any older versions -if [ -d ${INSTALL_DEST_BASE}/${PGM_NAME} ]; +if [ ! -d ${INSTALL_DEST_BASE} ]; then echo "" - echo "Removing existing ${PGM_NAME} installation from ${INSTALL_DEST_BASE}" + echo "!!! ERROR !!! - Installation location ${INSTALL_DEST_BASE} does not exist!" + echo "Installation will not complete." echo "" - - if [ "T" = ${HAS_XDG} ]; - then - sudo xdg-desktop-menu uninstall ${MENU_FILE_PATH} - sudo xdg-icon-resource uninstall --size 16 ${ICON_NAME} - sudo xdg-icon-resource uninstall --size 22 ${ICON_NAME} - sudo xdg-icon-resource uninstall --size 32 ${ICON_NAME} - sudo xdg-icon-resource uninstall --size 48 ${ICON_NAME} - - if [ -e /usr/share/icons/hicolor/scalable/apps/${ICON_NAME}.svg ]; - then - sudo rm -f /usr/share/icons/hicolor/scalable/apps/${ICON_NAME}.svg - fi - fi - - if [ -e ~/Desktop/${DESKTOP_LINK_FILE} ]; - then - sudo rm -f ~/Desktop/${DESKTOP_LINK_FILE} - fi - - # delete the old package - sudo rm -rf ${INSTALL_DEST_BASE}/${PGM_NAME} + read -p "Press ENTER to exit installer:" BLAH + exit 1 fi +# uninstall any older versions +UNINSTALLERS=$(find ${INSTALL_DEST_BASE} -maxdepth 1 -type f -name "${PGM_NAME}*.uninstall.sh") +if [ ! -z "$UNINSTALLERS" ]; +then + for i in $UNINSTALLERS; do + echo "" + echo "Found existing ${PGM_NAME} installation." + + ANSWER=$(VaildateYesNoQuestion "Do you want to run the uninstaller ${i} ?") + + if test "y" = $ANSWER; + then + echo "" + echo "Running uninstaller $i" + + ${i} + fi + done +fi + + +# install + echo "" -echo "Installing ${PGM_NAME} in ${INSTALL_DEST_BASE}" +echo "Installing ${PGM_NAME} ${PGM_VERSION} built from ${PGM_BUILD} in ${INSTALL_DEST_BASE}" echo "" # Copy the new version in the install directory -sudo mkdir ${INSTALL_DEST_BASE}/${PGM_NAME} -sudo cp -Rf ${BUNDLE_DIR}/* ${INSTALL_DEST_BASE}/${PGM_NAME} +sudo mkdir ${INSTALL_DEST_BASE}/${PGM_FULL_NAME} +sudo cp -Rf ${BUNDLE_DIR}/* ${INSTALL_DEST_BASE}/${PGM_FULL_NAME}/ # write the desktop/menu file echo "[Desktop Entry]" > /tmp/${MENU_FILE} @@ -265,13 +278,13 @@ echo "Version=1.0" >> /tmp/${MENU_FILE} echo "Type=Application" >> /tmp/${MENU_FILE} echo "Terminal=false" >> /tmp/${MENU_FILE} echo "Exec=${PGM_EXEC_PATH}" >> /tmp/${MENU_FILE} -echo "Name=${PGM_NAME}" >> /tmp/${MENU_FILE} +echo "Name=${PGM_NAME}-${PGM_VERSION}" >> /tmp/${MENU_FILE} echo "Icon=${ICON_NAME}" >> /tmp/${MENU_FILE} echo "Comment=Digital Audio Workstation" >> /tmp/${MENU_FILE} echo "Categories=AudioVideo;Audio;Recorder;" >> /tmp/${MENU_FILE} chmod ugo+rx /tmp/${MENU_FILE} -sudo mv /tmp/${MENU_FILE} ${MENU_FILE_PATH} +sudo mv /tmp/${MENU_FILE} ${MENU_FILE_PATH}/. # install the Menu, Link, and Icon(s) if [ "T" = ${HAS_XDG} ]; @@ -287,17 +300,24 @@ then sudo cp -f ${ICON_PATH}/${PGM_NAME_LOWER}_icon.svg /usr/share/icons/hicolor/scalable/apps/${ICON_NAME}.svg fi - sudo xdg-desktop-menu install ${MENU_FILE_PATH} + sudo xdg-desktop-menu install ${MENU_FILE_PATH}/${MENU_FILE} + echo "" echo "Creating a desktop link for ${PGM_NAME}" - cp ${MENU_FILE_PATH} ~/Desktop/${DESKTOP_LINK_FILE} + cp ${MENU_FILE_PATH}/${MENU_FILE} ~/Desktop/${DESKTOP_LINK_FILE} chmod ugo+rx ~/Desktop/${DESKTOP_LINK_FILE} else + echo "" echo "Creating a desktop link for ${PGM_NAME}" - cp ${MENU_FILE_PATH} ~/Desktop/${DESKTOP_LINK_FILE} + cp ${MENU_FILE_PATH}/${MENU_FILE} ~/Desktop/${DESKTOP_LINK_FILE} chmod ugo+rx ~/Desktop/${DESKTOP_LINK_FILE} fi +echo "" +echo "Copying uninstall script to ${INSTALL_DEST_BASE}" +echo "" + +sudo cp -f ${BUNDLE_DIR}/bin/*.uninstall.sh ${INSTALL_DEST_BASE}/. ########################### # Check Jack and qjackctl @@ -305,6 +325,7 @@ fi echo "" echo "Checking to see if Jack is installed" +echo "" if ! which jackd > /dev/null; then @@ -358,19 +379,19 @@ fi USER_GROUP_ADJUSTED="f" -if ! ./${BUNDLE_DIR}/sanityCheck -a > /dev/null; +if ! ./${BUNDLE_DIR}/bin/sanityCheck -a > /dev/null; then echo "" echo "System failed the quick sanity check... Looking for the cause" - if ! ./${BUNDLE_DIR}/sanityCheck -rt > /dev/null; + if ! ./${BUNDLE_DIR}/bin/sanityCheck -rt > /dev/null; then echo "" echo "System does not allow realtime for the current user... Looking for a solution" - if ./${BUNDLE_DIR}/sanityCheck -hasaudiogroup > /dev/null; + if ./${BUNDLE_DIR}/bin/sanityCheck -hasaudiogroup > /dev/null; then - if ./${BUNDLE_DIR}/sanityCheck -memberaudiogroup > /dev/null 2>&1; + if ./${BUNDLE_DIR}/bin/sanityCheck -memberaudiogroup > /dev/null 2>&1; then ## This is an odd case. We have an audio group and are a member. echo "" @@ -386,7 +407,7 @@ then else # Not a member of an audio group. Try to fix it. - if ./${BUNDLE_DIR}/sanityCheck -hasgroup audio > /dev/null && find /etc/security -type f -name "*.conf" | xargs grep -q "^@audio.*rtprio"; + if ./${BUNDLE_DIR}/bin/sanityCheck -hasgroup audio > /dev/null && find /etc/security -type f -name "*.conf" | xargs grep -q "^@audio.*rtprio"; then # add user to audio group echo "" @@ -408,7 +429,7 @@ then read -p "Press ENTER to continue:" BLAH fi - elif ./${BUNDLE_DIR}/sanityCheck -hasgroup jackuser > /dev/null && find /etc/security -type f -name "*.conf" | xargs grep -q "^@jackuser.*rtprio"; + elif ./${BUNDLE_DIR}/bin/sanityCheck -hasgroup jackuser > /dev/null && find /etc/security -type f -name "*.conf" | xargs grep -q "^@jackuser.*rtprio"; then # add user to jackuser group echo "" @@ -445,7 +466,7 @@ then fi fi - if ! ./${BUNDLE_DIR}/sanityCheck -freqscaling > /dev/null; + if ! ./${BUNDLE_DIR}/bin/sanityCheck -freqscaling > /dev/null; then echo "" echo "!!! WARNING !!! - Your system seems to use frequency scaling." @@ -459,7 +480,7 @@ then if [ "f" = $USER_GROUP_ADJUSTED ]; then - if ! ./${BUNDLE_DIR}/sanityCheck -memlock > /dev/null; + if ! ./${BUNDLE_DIR}/bin/sanityCheck -memlock > /dev/null; then echo "" echo "!!! WARNING !!! - You are not allowed to lock memory." diff --git a/tools/linux_packaging/uninstall.sh.in b/tools/linux_packaging/uninstall.sh.in new file mode 100644 index 0000000000..700594b94c --- /dev/null +++ b/tools/linux_packaging/uninstall.sh.in @@ -0,0 +1,83 @@ +#!/bin/sh + +###################################### +# +# Ardour/Mixbus bundle uninstaller +# Todd Naugle +# +##################################### + + +PGM_NAME="%REPLACE_PGM%" +PGM_VENDOR="%REPLACE_VENDOR%" +PGM_VERSION="%REPLACE_VERSION%" +PGM_BUILD="%REPLACE_BUILD%" + +INSTALL_DEST_BASE=/opt + + +#### Derived Variables #### +PGM_PATH=${INSTALL_DEST_BASE}/${PGM_NAME}-${PGM_VERSION}_${PGM_BUILD} + +ICON_NAME="${PGM_VENDOR}-${PGM_NAME}_${PGM_VERSION}" #no dash between name and version since seperates vendor from program +MENU_FILE="${PGM_VENDOR}-${PGM_NAME}_${PGM_VERSION}.desktop" #no dash between name and version since seperates vendor from program +DESKTOP_LINK_FILE="${PGM_NAME}_${PGM_VERSION}.desktop" +MENU_FILE_PATH="${PGM_PATH}/share/${MENU_FILE}" + + +####################### +# Check for xdg utils +####################### +HAS_XDG="T" + +XDG_MENU_VER=$(xdg-desktop-menu --version 2> /dev/null) +if [ -z "$XDG_MENU_VER" ]; +then + echo "System does not have xdg-desktop-menu installed" + HAS_XDG="F" +fi + +XDG_ICON_VER=$(xdg-icon-resource --version 2> /dev/null) +if [ -z "$XDG_ICON_VER" ]; +then + echo "System does not have xdg-icon-resource installed" + HAS_XDG="F" +fi + + +############# +# Uninstall +############# + +if [ -d ${PGM_PATH} ]; +then + echo "" + echo "Removing existing ${PGM_NAME} installation at ${PGM_PATH}" + echo "" + + if [ "T" = ${HAS_XDG} ]; + then + sudo xdg-desktop-menu uninstall ${MENU_FILE_PATH} + sudo xdg-icon-resource uninstall --size 16 ${ICON_NAME} + sudo xdg-icon-resource uninstall --size 22 ${ICON_NAME} + sudo xdg-icon-resource uninstall --size 32 ${ICON_NAME} + sudo xdg-icon-resource uninstall --size 48 ${ICON_NAME} + + if [ -e /usr/share/icons/hicolor/scalable/apps/${ICON_NAME}.svg ]; + then + sudo rm -f /usr/share/icons/hicolor/scalable/apps/${ICON_NAME}.svg + fi + fi + + if [ -e ~/Desktop/${DESKTOP_LINK_FILE} ]; + then + sudo rm -f ~/Desktop/${DESKTOP_LINK_FILE} + fi + + # delete the old package + sudo rm -rf ${PGM_PATH} +else + echo "" + echo "!!! FAILURE !!! - install path ${PGM_PATH} does not exist." + echo "" +fi