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