wok rev 16807

Fix missings entries in Menu
author Stanislas Leduc <shann@slitaz.org>
date Wed Jul 09 18:46:01 2014 +0200 (2014-07-09)
parents 1c473ed1c351
children 345677019f4e
files get-LibreOffice/stuff/get-LibreOffice
line diff
     1.1 --- a/get-LibreOffice/stuff/get-LibreOffice	Wed Jul 09 11:25:23 2014 +0200
     1.2 +++ b/get-LibreOffice/stuff/get-LibreOffice	Wed Jul 09 18:46:01 2014 +0200
     1.3 @@ -7,14 +7,9 @@
     1.4  #
     1.5  
     1.6  PACKAGE="LibreOffice"
     1.7 -WEB_SITE="http://www.libreoffice.org"
     1.8 -CATEGORY="office"
     1.9 -SHORT_DESC="Productivity suite."
    1.10 -DEPENDS="cups"
    1.11 -SUGGESTED="java6-jre"
    1.12 +URL="http://www.libreoffice.org"
    1.13  ROOT="$1"
    1.14  DIR="stable"
    1.15 -PREFIX="LibreOffice"
    1.16  SUFFIX="Linux_x86_rpm.tar.gz"
    1.17  WGET_URL="http://download.documentfoundation.org/libreoffice/$DIR"
    1.18  
    1.19 @@ -27,11 +22,11 @@
    1.20  VER="${VERSION/\-/}" # without hyphens
    1.21  
    1.22  
    1.23 -TARBALL="${PREFIX}_${VER}_${SUFFIX}"
    1.24 +TARBALL="LibreOffice_${VER}_${SUFFIX}"
    1.25  
    1.26  for LOC in ${LANG/_/-} ${LANG%_*}; do
    1.27  	L_SUFFIX="Linux_x86_rpm_langpack_$LOC.tar.gz"
    1.28 -	L_TARBALL="${PREFIX}_${VER}_${L_SUFFIX}"
    1.29 +	L_TARBALL="LibreOffice_${VER}_${L_SUFFIX}"
    1.30  	LANG_URL="$WGET_URL/${VERSION}/rpm/x86/${L_TARBALL}"
    1.31  	busybox wget -s $LANG_URL 2> /dev/null || continue
    1.32  	echo "Added $LANG ($LOC)."
    1.33 @@ -110,7 +105,9 @@
    1.34  		wget -c $LANG_URL -O $SOURCE_DIR/$L_TARBALL
    1.35  	fi
    1.36  	status
    1.37 +	
    1.38  fi
    1.39 +
    1.40  if [ ! -f $SOURCE_DIR/$TARBALL ]; then
    1.41  	rm -rf $SOURCE_DIR
    1.42  	echo "Could not download $TARBALL. Exiting."
    1.43 @@ -124,10 +121,10 @@
    1.44  for TB in $TARBALL $L_TARBALL ; do
    1.45  	tar xvzf $SOURCE_DIR/$TB -C $TEMP_DIR > $LOG 2>&1 || \
    1.46  	(echo "Failed to extract $TB" ; exit 1)
    1.47 -done
    1.48 +done 
    1.49  
    1.50  # Get version found in archive (often directory is still RC version when final is present)
    1.51 -ARCHIVED_VERSION=$(find $TEMP_DIR -type d 2> /dev/null | sed "/$PREFIX/!d;\$!d;s/_/ /g" | awk '{print $2}')
    1.52 +ARCHIVED_VERSION=`cd $TEMP_DIR;find . -type d 2> /dev/null | grep LibreOffice | head -n 1 | sed 's/_/ /g' | awk '{print $2}'`
    1.53  echo -n "(found v${ARCHIVED_VERSION})"
    1.54  
    1.55  # Consolidate localisations into main package
    1.56 @@ -150,32 +147,35 @@
    1.57  		(rpm2cpio $i | cpio -id >> $LOG 2>&1 ) && rm  -f $i
    1.58  	fi
    1.59  done
    1.60 -rpm2cpio libobasis*-gnome-integration*.rpm | cpio -id >> $LOG 2>&1
    1.61 +
    1.62 +#rpm2cpio desktop-integration/*freedesktop*.rpm | cpio -id >> $LOG 2>&1
    1.63 +#rpm2cpio *freedesktop*.rpm | cpio -id >> $LOG 2>&1
    1.64  
    1.65  # extracted pkg can be removed: Save RAM
    1.66 -rm -f libobasis*.rpm
    1.67 +rm -f desktop-integration/*freedesktop*.rpm
    1.68  
    1.69  status
    1.70  echo -n "Preparing package... "
    1.71  
    1.72  # Make the package
    1.73 -mkdir -p $PACKAGE-$VERSION/fs/usr/lib $PACKAGE-$VERSION/fs/usr/share
    1.74 +mkdir -p $PACKAGE-$VERSION/fs/usr/lib/libreoffice  \
    1.75 +         $PACKAGE-$VERSION/fs/usr/share
    1.76  
    1.77  # use mv instead of 'cp -a' to save RAM
    1.78 -mv opt/libreoffice* $PACKAGE-$VERSION/fs/usr/lib/libreoffice
    1.79 +mv opt/libreoffice* $PACKAGE-$VERSION/fs/usr/lib
    1.80  mv usr/share/mime $PACKAGE-$VERSION/fs/usr/share
    1.81  mv usr/share/icons $PACKAGE-$VERSION/fs/usr/share
    1.82  mv usr/bin $PACKAGE-$VERSION/fs/usr
    1.83  
    1.84  # relocalized libexec directory
    1.85 -bin=$(echo $PACKAGE-$VERSION/fs/usr/bin/libreoffice${VERSION%.*})
    1.86 +bin=$(ls $PACKAGE-$VERSION/fs/usr/bin/libreoffice???)
    1.87  if [ -L $bin ]; then
    1.88  	target=$(readlink $bin)
    1.89  	rm -f $bin
    1.90  	ln -s ${target/opt/usr\/lib\/libreoffice} $bin
    1.91  else
    1.92  	sed -i 's#/opt/#/usr/lib/libreoffice/#'  $bin
    1.93 -fi
    1.94 +fi	
    1.95  
    1.96  # Create receipt
    1.97  cat > $PACKAGE-$VERSION/receipt <<EOT
    1.98 @@ -183,33 +183,39 @@
    1.99  
   1.100  PACKAGE="$PACKAGE"
   1.101  VERSION="$VERSION"
   1.102 -CATEGORY="$CATEGORY"
   1.103 -SHORT_DESC="$SHORT_DESC"
   1.104 -WEB_SITE="$WEB_SITE"
   1.105 -
   1.106 -DEPENDS="$DEPENDS"
   1.107 -SUGGESTED="$SUGGESTED"
   1.108 +CATEGORY="office"
   1.109 +SHORT_DESC="Productivity suite."
   1.110 +DEPENDS="java6-jre cups"
   1.111 +WEB_SITE="$URL"
   1.112  
   1.113  post_install()
   1.114  {
   1.115 -	cd \$1/usr/share/applications
   1.116 -	ln -s /usr/lib/libreoffice*/share/xdg/base.desktop          libreoffice-base.desktop
   1.117 -	ln -s /usr/lib/libreoffice*/share/xdg/impress.desktop       libreoffice-impress.desktop
   1.118 -	ln -s /usr/lib/libreoffice*/share/xdg/writer.desktop        libreoffice-writer.desktop
   1.119 -	ln -s /usr/lib/libreoffice*/share/xdg/calc.desktop          libreoffice-calc.desktop
   1.120 -	ln -s /usr/lib/libreoffice*/share/xdg/math.desktop          libreoffice-math.desktop
   1.121 -	ln -s /usr/lib/libreoffice*/share/xdg/draw.desktop          libreoffice-draw.desktop
   1.122 -	ln -s /usr/lib/libreoffice*/share/xdg/printeradmin.desktop libreoffice-printeradmin.desktop
   1.123 -	chmod +x /usr/lib/libreoffice*/share/xdg/*.desktop
   1.124 +        ln -sf /usr/lib/libreoffice?* /usr/lib/libreoffice
   1.125 +        path_libreoffice=\$(find /usr/lib/libreoffice -name libreoffice*.*)
   1.126  
   1.127 -	cd \$1/usr/bin
   1.128 -	ln -sf /usr/lib/libreoffice/program/soffice
   1.129 -	ln -sf /usr/lib/libreoffice/program/soffice libreoffice${VERSION%.*}
   1.130 +        # Remove links if exist
   1.131 +        rm -f /usr/share/applications/libreoffice-*
   1.132 +
   1.133 +        # Create links
   1.134 +        cd /usr/share/applications
   1.135 +        ln -sf \$path_libreoffice/share/xdg/base.desktop          libreoffice-base.desktop
   1.136 +        ln -sf \$path_libreoffice/share/xdg/impress.desktop       libreoffice-impress.desktop
   1.137 +        ln -sf \$path_libreoffice/share/xdg/writer.desktop        libreoffice-writer.desktop
   1.138 +        ln -sf \$path_libreoffice/share/xdg/calc.desktop          libreoffice-calc.desktop
   1.139 +        ln -sf \$path_libreoffice/share/xdg/math.desktop          libreoffice-math.desktop
   1.140 +        ln -sf \$path_libreoffice/share/xdg/draw.desktop          libreoffice-draw.desktop
   1.141 +
   1.142 +        chmod +x \$path_libreoffice/share/xdg/*.desktop
   1.143 +
   1.144 +        # If necessary, recreate links for soffice
   1.145 +        rm -f /usr/bin/soffice /usr/bin/libreoffice
   1.146 +        ln -sf \$path_libreoffice/program/soffice /usr/bin/libreoffice
   1.147 +        ln -sf \$path_libreoffice/program/soffice /usr/bin/soffice
   1.148  }
   1.149  
   1.150  post_remove()
   1.151  {
   1.152 -	rm -f \$1/usr/share/applications/libreoffice-*
   1.153 +	rm -f /usr/share/applications/libreoffice-*
   1.154  }
   1.155  
   1.156  EOT