| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
if test -z "${SRC_ROOT}"; then |
| 4 |
echo "distro-install-clean-up: No environment set!" |
| 5 |
exit 1 |
| 6 |
fi |
| 7 |
|
| 8 |
PRODUCTVERSION_NODOT=`echo $PRODUCTVERSION | sed -e "s/\.//"` |
| 9 |
|
| 10 |
mkdir -p "$DESTDIR$BINDIR" |
| 11 |
|
| 12 |
create_wrapper() |
| 13 |
{ |
| 14 |
echo "Install $BINDIR/$1" |
| 15 |
|
| 16 |
if test -L "$DESTDIR$BINDIR/$1" ; then |
| 17 |
# do not overwrite $BINDIR/libreoffice symlink created by create_tree.sh |
| 18 |
# the symlink is necessary by java UNO components to find |
| 19 |
# the UNO installation using $PATH; this function used to be provided |
| 20 |
# by $BINDIR/soffice symlink, see |
| 21 |
# http://udk.openoffice.org/common/man/spec/transparentofficecomponents.html |
| 22 |
# Note: if you want to support parallel installation of more OOo versions |
| 23 |
# you cannot include this link directly into the package |
| 24 |
# For example, the Novell package mark this symlink as %ghost |
| 25 |
# and update it in %post and %postun |
| 26 |
echo " skip already existing symlink $BINDIR/$1" |
| 27 |
else |
| 28 |
mkdir -p "$DESTDIR$BINDIR" |
| 29 |
cat <<EOT >"$DESTDIR$BINDIR/$1" |
| 30 |
#!/bin/sh |
| 31 |
$INSTALLDIR/program/$2 $3 "\$@" |
| 32 |
EOT |
| 33 |
chmod 755 "$DESTDIR$BINDIR/$1" |
| 34 |
fi |
| 35 |
# put into file list |
| 36 |
test -f "$DESTDIR/$4" && echo "$BINDIR/$1" >>$DESTDIR/$4 |
| 37 |
} |
| 38 |
|
| 39 |
create_man_link() |
| 40 |
{ |
| 41 |
echo "Install $MANDIR/man1/$1.1.gz" |
| 42 |
|
| 43 |
mkdir -p $DESTDIR$MANDIR/man1 |
| 44 |
echo ".so man1/$2.1" >| $DESTDIR$MANDIR/man1/$1.1 |
| 45 |
gzip -f $DESTDIR$MANDIR/man1/$1.1 |
| 46 |
test -f "$DESTDIR/$3" && echo "$MANDIR/man1/$1.1.gz" >>"$DESTDIR/$3" |
| 47 |
} |
| 48 |
|
| 49 |
install_man() |
| 50 |
{ |
| 51 |
echo "Install $MANDIR/man1/$1.1.gz" |
| 52 |
|
| 53 |
mkdir -p $DESTDIR$MANDIR/man1 |
| 54 |
cp "${SRCDIR?}"/sysui/desktop/man/$1.1 $DESTDIR$MANDIR/man1 || exit 1; |
| 55 |
gzip -f $DESTDIR$MANDIR/man1/$1.1 |
| 56 |
test -f "$DESTDIR/$2" && echo "$MANDIR/man1/$1.1.gz" >>"$DESTDIR/$2" |
| 57 |
} |
| 58 |
|
| 59 |
|
| 60 |
add_wrapper() |
| 61 |
{ |
| 62 |
lowrapper_name="$1" |
| 63 |
target_binary="$2" |
| 64 |
target_option_1="$3" |
| 65 |
used_man_page="$4" |
| 66 |
desktop_file="$5" |
| 67 |
file_list="$6" |
| 68 |
|
| 69 |
# do we want compat oowrapper? |
| 70 |
oowrapper_name="" |
| 71 |
if test "$WITH_COMPAT_OOWRAPPERS" = 'TRUE' ; then |
| 72 |
oowrapper_name=`echo "$lowrapper_name" | sed -e "s/^lo/oo/"` |
| 73 |
# "oo" prefix only for wrappers stating with "lo" prefix |
| 74 |
test "$oowrapper_name" = "$lowrapper_name" && oowrapper_name= |
| 75 |
fi |
| 76 |
|
| 77 |
# wrappers |
| 78 |
create_wrapper "$lowrapper_name" "$target_binary" "$target_option_1" "$file_list" |
| 79 |
test -n "$oowrapper_name" && create_wrapper "$oowrapper_name" "$target_binary" "$target_option_1" "$file_list" |
| 80 |
|
| 81 |
# man pages |
| 82 |
if test "$used_man_page" = "$lowrapper_name" ; then |
| 83 |
# need to install the manual page |
| 84 |
install_man "$lowrapper_name" "$file_list" |
| 85 |
else |
| 86 |
# just link the manual page |
| 87 |
create_man_link "$lowrapper_name" "$used_man_page" "$file_list" |
| 88 |
fi |
| 89 |
test -n "$oowrapper_name" && create_man_link "$oowrapper_name" "$used_man_page" "$file_list" |
| 90 |
|
| 91 |
# add desktop file to the right file list |
| 92 |
test -n "$desktop_file" -a -f "$DESTDIR/$file_list" && echo "$PREFIXDIR/share/applications/$desktop_file" >>"$DESTDIR/$file_list" |
| 93 |
} |
| 94 |
|
| 95 |
# install desktop integration from plain packages |
| 96 |
sysui_temp=`mktemp -d -t distro-pack-desktop-integration-XXXXXX` |
| 97 |
cp -a workdir/CustomTarget/sysui/share/libreoffice/* "$sysui_temp" |
| 98 |
cp -a "${SRCDIR?}"/sysui/desktop/share/create_tree.sh "$sysui_temp" |
| 99 |
cd $sysui_temp |
| 100 |
# we want non-versioned stuff in the distro packages |
| 101 |
sed -i \ |
| 102 |
-e "s/\($INSTALLDIRNAME\)$PRODUCTVERSION_NODOT/\1/" \ |
| 103 |
-e "s/\($INSTALLDIRNAME\)$PRODUCTVERSION/\1/" \ |
| 104 |
-e "s/\($PRODUCTNAME\) $PRODUCTVERSION/\1/" \ |
| 105 |
* |
| 106 |
# call in subshell to do not malform PRODUCTVERSION, ... |
| 107 |
( |
| 108 |
export OFFICE_PREFIX=$LIBDIR |
| 109 |
export PREFIX=$INSTALLDIRNAME |
| 110 |
export ICON_PREFIX=$INSTALLDIRNAME |
| 111 |
export ICON_SOURCE_DIR="${SRCDIR?}"/sysui/desktop/icons |
| 112 |
export PRODUCTVERSION= |
| 113 |
export KDEMAINDIR=$PREFIXDIR |
| 114 |
export PREFIXDIR=${PREFIXDIR} |
| 115 |
export APPDATA_SOURCE_DIR="${SRCDIR?}"/sysui/desktop/appstream-appdata |
| 116 |
bash ./create_tree.sh |
| 117 |
) |
| 118 |
cd - |
| 119 |
rm -rf $sysui_temp |
| 120 |
|
| 121 |
# we do not want some stuff from the plain packages |
| 122 |
if test -d $DESTDIR/opt ; then |
| 123 |
rm -f $DESTDIR/opt/$INSTALLDIRNAME |
| 124 |
rmdir $DESTDIR/opt 2>/dev/null || true |
| 125 |
fi |
| 126 |
|
| 127 |
# we want non-versioned desktop files |
| 128 |
cd $DESTDIR/$INSTALLDIR/share/xdg |
| 129 |
# we want non-versioned stuff in the distro packages |
| 130 |
sed -i \ |
| 131 |
-e "s/\($INSTALLDIRNAME\)$PRODUCTVERSION_NODOT/\1/" \ |
| 132 |
-e "s/\($INSTALLDIRNAME\)$PRODUCTVERSION/\1/" \ |
| 133 |
-e "s/\($PRODUCTNAME\) $PRODUCTVERSION/\1/" \ |
| 134 |
*.desktop |
| 135 |
cd - |
| 136 |
|
| 137 |
# put the stuff installed by create_tree.sh into the right file lists |
| 138 |
# desktop files will be added by the corresponding add_wrapper command |
| 139 |
if test -f $DESTDIR/gid_Module_Root_Brand ; then |
| 140 |
for dir in $PREFIXDIR/share/mime/packages \ |
| 141 |
$PREFIXDIR/share/icons ; do |
| 142 |
find "$DESTDIR$dir" \( -type f -o -type l \) -printf "$dir/%P\n" >>$DESTDIR/gid_Module_Root_Brand |
| 143 |
done |
| 144 |
fi |
| 145 |
|
| 146 |
# wrappers and man pages |
| 147 |
# FIXME: do not have desktop file and MIME icon for unopkg |
| 148 |
add_wrapper lobase soffice "--base" "libreoffice" "libreoffice-base.desktop" "gid_Module_Brand_Prg_Base" |
| 149 |
add_wrapper localc soffice "--calc" "libreoffice" "libreoffice-calc.desktop" "gid_Module_Brand_Prg_Calc" |
| 150 |
add_wrapper lodraw soffice "--draw" "libreoffice" "libreoffice-draw.desktop" "gid_Module_Brand_Prg_Draw" |
| 151 |
add_wrapper lomath soffice "--math" "libreoffice" "libreoffice-math.desktop" "gid_Module_Brand_Prg_Math" |
| 152 |
add_wrapper loimpress soffice "--impress" "libreoffice" "libreoffice-impress.desktop" "gid_Module_Brand_Prg_Impress" |
| 153 |
add_wrapper loweb soffice "--web" "libreoffice" "" "gid_Module_Brand_Prg_Wrt" |
| 154 |
add_wrapper lowriter soffice "--writer" "libreoffice" "libreoffice-writer.desktop" "gid_Module_Brand_Prg_Wrt" |
| 155 |
add_wrapper lofromtemplate soffice ".uno:NewDoc" "libreoffice" "" "gid_Module_Root_Brand" |
| 156 |
add_wrapper libreoffice soffice "" "libreoffice" "libreoffice-startcenter.desktop" "gid_Module_Root_Brand" |
| 157 |
add_wrapper loffice soffice "" "libreoffice" "" "gid_Module_Root_Brand" |
| 158 |
add_wrapper unopkg unopkg "" "unopkg" "" "gid_Module_Root_Brand" |
| 159 |
|
| 160 |
# there are two more desktop files for optional filters |
| 161 |
test -f $DESTDIR/gid_Module_Optional_Xsltfiltersamples && echo "$PREFIXDIR/share/applications/libreoffice-xsltfilter.desktop" >>"$DESTDIR/gid_Module_Optional_Xsltfiltersamples" |
| 162 |
|
| 163 |
# $BINDIR/ooffice symlink is necessary by java UNO components to find |
| 164 |
# the UNO installation using $PATH, see |
| 165 |
# http://udk.openoffice.org/common/man/spec/transparentofficecomponents.html |
| 166 |
# Note: if you want to support parallel installation of more OOo versions |
| 167 |
# you cannot include this link directly into the package |
| 168 |
# For example, the Novell package mark this symlink as %ghost |
| 169 |
# and update it in %post and %postun |
| 170 |
ln -sf "$INSTALLDIR/program/soffice" "$DESTDIR$BINDIR/soffice" |
| 171 |
test -f $DESTDIR/gid_Module_Root_Brand && echo "$BINDIR/soffice" >>$DESTDIR/gid_Module_Root_Brand |
| 172 |
|
| 173 |
# create bash completion |
| 174 |
mkdir -p $DESTDIR/usr/share/bash-completion/completions |
| 175 |
"${SRCDIR?}"/bin/generate-bash-completion.py bin/bash-completion.in $DESTDIR/usr/share/bash-completion/completions/$INSTALLDIRNAME.sh |
| 176 |
test -f $DESTDIR/gid_Module_Root_Brand && echo "/usr/share/bash-completion/completions/$INSTALLDIRNAME.sh" >>$DESTDIR/gid_Module_Root_Brand |
| 177 |
if test "$WITH_COMPAT_OOWRAPPERS" = "TRUE" ; then |
| 178 |
"${SRCDIR?}"/bin/generate-bash-completion.py --compat-oowrappers bin/bash-completion.in $DESTDIR/usr/share/bash-completion/completions/ooffice.sh |
| 179 |
test -f $DESTDIR/gid_Module_Root_Brand && echo "/usr/share/bash-completion/completions/ooffice.sh" >>$DESTDIR/gid_Module_Root_Brand |
| 180 |
fi |
| 181 |
|
| 182 |
echo "Install $OOINSTDIR/basis$VERSION/program/java-set-classpath"; |
| 183 |
mkdir -p $DESTDIR$INSTALLDIR/program |
| 184 |
sed -e "s|@INSTALLDIR@|$INSTALLDIR|g" "${SRCDIR?}"/bin/java-set-classpath.in >| "$DESTDIR$INSTALLDIR/program/java-set-classpath" || exit 1; |
| 185 |
chmod 755 "$DESTDIR$INSTALLDIR/program/java-set-classpath" |
| 186 |
test -f $DESTDIR/gid_Module_Root_Brand && echo "$INSTALLDIR/program/java-set-classpath" >>$DESTDIR/gid_Module_Root_Brand |
| 187 |
|
| 188 |
exit 0 |