update credits
[LibreOffice.git] / bin / distro-install-desktop-integration
blob1da104e47621440dbf30f8246c80609a7f66139c
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$BINDIR"
12 create_wrapper()
14 echo "Install $BINDIR/$1"
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"
35 # put into file list
36 test -f "$DESTDIR/$4" && echo "$BINDIR/$1" >>$DESTDIR/$4
39 create_man_link()
41 echo "Install $MANDIR/man1/$1.1.gz"
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"
49 install_man()
51 echo "Install $MANDIR/man1/$1.1.gz"
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"
60 add_wrapper()
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"
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=
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"
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"
89 test -n "$oowrapper_name" && create_man_link "$oowrapper_name" "$used_man_page" "$file_list"
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"
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/" \
106 # call in subshell to do not malform PRODUCTVERSION, ...
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 GNOMEDIR=$PREFIXDIR
116 export GNOME_MIME_THEME=hicolor
117 export APPDATA_SOURCE_DIR="${SRCDIR?}"/sysui/desktop/appstream-appdata
118 bash ./create_tree.sh
120 cd -
121 rm -rf $sysui_temp
123 # we do not want some stuff from the plain packages
124 if test -d $DESTDIR/opt ; then
125 rm -f $DESTDIR/opt/$INSTALLDIRNAME
126 rmdir $DESTDIR/opt 2>/dev/null || true
129 # we want non-versioned desktop files
130 cd $DESTDIR/$INSTALLDIR/share/xdg
131 # we want non-versioned stuff in the distro packages
132 sed -i \
133 -e "s/\($INSTALLDIRNAME\)$PRODUCTVERSION_NODOT/\1/" \
134 -e "s/\($INSTALLDIRNAME\)$PRODUCTVERSION/\1/" \
135 -e "s/\($PRODUCTNAME\) $PRODUCTVERSION/\1/" \
136 *.desktop
137 cd -
139 # put the stuff installed by create_tree.sh into the right file lists
140 # desktop files will be added by the corresponding add_wrapper command
141 if test -f $DESTDIR/gid_Module_Root_Brand ; then
142 for dir in $PREFIXDIR/share/application-registry \
143 $PREFIXDIR/share/mime/packages \
144 $PREFIXDIR/share/mime-info \
145 $PREFIXDIR/share/icons ; do
146 find "$DESTDIR$dir" \( -type f -o -type l \) -printf "$dir/%P\n" >>$DESTDIR/gid_Module_Root_Brand
147 done
150 # wrappers and man pages
151 # FIXME: do not have desktop file and MIME icon for unopkg
152 add_wrapper lobase soffice "--base" "libreoffice" "libreoffice-base.desktop" "gid_Module_Brand_Prg_Base"
153 add_wrapper localc soffice "--calc" "libreoffice" "libreoffice-calc.desktop" "gid_Module_Brand_Prg_Calc"
154 add_wrapper lodraw soffice "--draw" "libreoffice" "libreoffice-draw.desktop" "gid_Module_Brand_Prg_Draw"
155 add_wrapper lomath soffice "--math" "libreoffice" "libreoffice-math.desktop" "gid_Module_Brand_Prg_Math"
156 add_wrapper loimpress soffice "--impress" "libreoffice" "libreoffice-impress.desktop" "gid_Module_Brand_Prg_Impress"
157 add_wrapper loweb soffice "--web" "libreoffice" "" "gid_Module_Brand_Prg_Wrt"
158 add_wrapper lowriter soffice "--writer" "libreoffice" "libreoffice-writer.desktop" "gid_Module_Brand_Prg_Wrt"
159 add_wrapper lofromtemplate soffice ".uno:NewDoc" "libreoffice" "" "gid_Module_Root_Brand"
160 add_wrapper libreoffice soffice "" "libreoffice" "libreoffice-startcenter.desktop" "gid_Module_Root_Brand"
161 add_wrapper loffice soffice "" "libreoffice" "" "gid_Module_Root_Brand"
162 add_wrapper unopkg unopkg "" "unopkg" "" "gid_Module_Root_Brand"
164 # there are two more desktop files for optional filters
165 test -f $DESTDIR/gid_Module_Optional_Xsltfiltersamples && echo "$PREFIXDIR/share/applications/libreoffice-xsltfilter.desktop" >>"$DESTDIR/gid_Module_Optional_Xsltfiltersamples"
167 # $BINDIR/ooffice symlink is necessary by java UNO components to find
168 # the UNO installation using $PATH, see
169 # http://udk.openoffice.org/common/man/spec/transparentofficecomponents.html
170 # Note: if you want to support parallel installation of more OOo versions
171 # you cannot include this link directly into the package
172 # For example, the Novell package mark this symlink as %ghost
173 # and update it in %post and %postun
174 ln -sf "$INSTALLDIR/program/soffice" "$DESTDIR$BINDIR/soffice"
175 test -f $DESTDIR/gid_Module_Root_Brand && echo "$BINDIR/soffice" >>$DESTDIR/gid_Module_Root_Brand
177 # create bash completion
178 mkdir -p $DESTDIR/usr/share/bash-completion/completions
179 "${SRCDIR?}"/bin/generate-bash-completion.py bin/bash-completion.in $DESTDIR/usr/share/bash-completion/completions/$INSTALLDIRNAME.sh
180 test -f $DESTDIR/gid_Module_Root_Brand && echo "/usr/share/bash-completion/completions/$INSTALLDIRNAME.sh" >>$DESTDIR/gid_Module_Root_Brand
181 if test "$WITH_COMPAT_OOWRAPPERS" = "TRUE" ; then
182 "${SRCDIR?}"/bin/generate-bash-completion.py --compat-oowrappers bin/bash-completion.in $DESTDIR/usr/share/bash-completion/completions/ooffice.sh
183 test -f $DESTDIR/gid_Module_Root_Brand && echo "/usr/share/bash-completion/completions/ooffice.sh" >>$DESTDIR/gid_Module_Root_Brand
186 echo "Install $OOINSTDIR/basis$VERSION/program/java-set-classpath";
187 mkdir -p $DESTDIR$INSTALLDIR/program
188 sed -e "s|@INSTALLDIR@|$INSTALLDIR|g" "${SRCDIR?}"/bin/java-set-classpath.in >| "$DESTDIR$INSTALLDIR/program/java-set-classpath" || exit 1;
189 chmod 755 "$DESTDIR$INSTALLDIR/program/java-set-classpath"
190 test -f $DESTDIR/gid_Module_Root_Brand && echo "$INSTALLDIR/program/java-set-classpath" >>$DESTDIR/gid_Module_Root_Brand
192 exit 0