postinstall scriptlet (through /bin/sh): generate_wmconfig() { # arg1 = location wmconfig_file="${1}/opera" wmconfig_contain='opera name "Opera" opera description "Opera Web Browser" opera icon "opera.xpm" opera mini-icon "opera.xpm" opera exec "opera &" opera group "Internet"' echo "${wmconfig_contain}" > ${wmconfig_file} chmod $chmodv 644 ${wmconfig_file} } generate_desktop() { # arg1 = location # arg2 = type desktop_file="${1}/opera.desktop" desktop_contain='[Desktop Entry]' if test ${2}; then if test "${2}" = "xdg"; then desktop_contain="${desktop_contain} Version=1.0 TryExec=opera" fi desktop_contain="${desktop_contain} Encoding=UTF-8 Name=Opera Name[af]=opera Name[eo]=Opero Name[zu]=I Opera GenericName=Web browser GenericName[bs]=Web preglednik GenericName[de]=Web-Browser GenericName[eo]=TTT-rigardilo GenericName[es]=Navegador web GenericName[et]=Veebibrauser GenericName[eu]=Web arakatzailea GenericName[fi]=WWW-selain GenericName[fr]=Un navigateur web GenericName[is]=Vafri GenericName[it]=Browser Web GenericName[nl]=webbrowser GenericName[nn]=Nettlesar GenericName[pt]=Navegador Web GenericName[pt_BR]=Navegador GenericName[ro]=Navigator de web GenericName[sl]=Spletni brskalnik GenericName[ven]=Buronza ya Webu GenericName[xh]=Umkhangeli Zincwadi Zokubhaliweyo GenericName[zu]=Umkhangeli zincwadi we Web Exec=opera %u Terminal=false" # Application is not a category, according to # http://standards.freedesktop.org/menu-spec/menu-spec-latest.html # # but I include it anyway to fix # http://bugs.gentoo.org/show_bug.cgi?id=90508 # # Other possible Categories: # Email, Presentation, IRCClient, FileTransfer, P2P, News, WebDevelopment if test "${2}" = "xdg"; then desktop_contain="${desktop_contain} Categories=Application;Qt;Network;WebBrowser;X-Ximian-Main;X-Ximian-Toplevel Icon=opera.png" else desktop_contain="${desktop_contain} Icon=opera" fi desktop_contain="${desktop_contain} MimeType=text/html;text/xml;application/xhtml+xml" else desktop_contain="${desktop_contain} Name=Opera Exec=opera Icon=opera.xpm Terminal=0" fi desktop_contain="${desktop_contain} Comment=Web Browser Type=Application" echo "${desktop_contain}" > ${desktop_file} chmod $chmodv 644 ${desktop_file} } generate_mdk_menu() { # arg1 = location mdk_menu_file="${1}/opera" mdk_menu_contain="?package(opera):command=\"${wrapper_dir}/opera\" \\ icon=\"opera.png\" \\ needs=\"X11\" \\ section=\"Networking/WWW\" \\ title=\"Opera\" \\ longtitle=\"Opera Web Browser\" \\ mimetypes=\"text/html,text/plain,text/vnd.csr,text/vnd.wap.wml,text/wml,text/xml,text/xhtml\" \\ accept_url=\"true\" \\ multiple_files=\"false\"" echo "${mdk_menu_contain}" > ${mdk_menu_file} chmod $chmodv 644 ${mdk_menu_file} } icons() { # This function searches for common icon paths. if test ! -d /usr/share/icons; then if test -w /usr/share; then mkdir $mkdirv $mkdirp /usr/share/icons/ chmod $chmodv 755 /usr/share/icons cp $cpv $share_dir/images/opera.xpm /usr/share/icons/opera.xpm fi elif test -w /usr/share/icons; then cp $cpv $share_dir/images/opera.xpm /usr/share/icons/opera.xpm fi if test ! -d /usr/share/pixmaps; then if test -w /usr/share; then mkdir $mkdirv $mkdirp /usr/share/pixmaps/ chmod $chmodv 755 /usr/share/pixmaps cp $cpv $share_dir/images/opera.xpm /usr/share/pixmaps/opera.xpm fi elif test -w /usr/share/pixmaps/; then cp $cpv $share_dir/images/opera.xpm /usr/share/pixmaps/opera.xpm fi if test ! -d /etc/X11/wmconfig/; then if test -w /etc/X11; then mkdir $mkdirv $mkdirp /etc/X11/wmconfig/ chmod $chmodv 755 /etc/X11/wmconfig generate_wmconfig /etc/X11/wmconfig fi elif test -w /etc/X11/wmconfig/; then generate_wmconfig /etc/X11/wmconfig fi if test -d /etc/X11/applnk/; then if test ! -d /etc/X11/applnk/Internet/; then if test -w /etc/X11/applnk; then mkdir $mkdirv $mkdirp /etc/X11/applnk/Internet/ chmod $chmodv 755 /etc/X11/applnk/Internet generate_desktop /etc/X11/applnk/Internet fi elif test -w /etc/X11/applnk/Internet; then generate_desktop /etc/X11/applnk/Internet fi fi } gnome() { # This function searches for common gnome icon paths. if test -d /opt/gnome/; then # /opt/gnome share if test -d /opt/gnome/share; then # /opt/gnome icon if test ! -d /opt/gnome/share/pixmaps/; then if test -w /opt/gnome/share; then mkdir $mkdirv $mkdirp /opt/gnome/share/pixmaps/ chmod $chmodv 755 /opt/gnome/share/pixmaps cp $cpv $share_dir/images/opera.xpm /opt/gnome/share/pixmaps/opera.xpm fi elif test -w /opt/gnome/share/pixmaps; then cp $cpv $share_dir/images/opera.xpm /opt/gnome/share/pixmaps/opera.xpm fi # end /opt/gnome icon # /opt/gnome link if test -d /opt/gnome/share/gnome/apps/; then if test -d /opt/gnome/share/gnome/apps/Internet/; then if test -w /opt/gnome/share/gnome/apps/Internet; then generate_desktop /opt/gnome/share/gnome/apps/Internet fi elif test -d /opt/gnome/share/gnome/apps/Networking/WWW/; then if test -w /opt/gnome/share/gnome/apps/Networking/WWW; then generate_desktop /opt/gnome/share/gnome/apps/Networking/WWW fi elif test -w /opt/gnome/share/gnome/apps; then mkdir $mkdirv $mkdirp /opt/gnome/share/gnome/apps/Internet/ chmod $chmodv 755 /opt/gnome/share/gnome/apps/Internet generate_desktop /opt/gnome/share/gnome/apps/Internet fi fi # end /opt/gnome link fi # end /opt/gnome share elif test -d /usr/share/gnome/; then # /usr/share/gnome icon if test ! -d /usr/share/gnome/pixmaps/; then if test -w /usr/share/gnome; then mkdir $mkdirv $mkdirp /usr/share/gnome/pixmaps/ chmod $chmodv 755 /usr/share/gnome/pixmaps cp $cpv $share_dir/images/opera.xpm /usr/share/gnome/pixmaps/opera.xpm fi elif test -w /usr/share/gnome/pixmaps; then cp $cpv $share_dir/images/opera.xpm /usr/share/gnome/pixmaps/opera.xpm fi # end /usr/share/gnome icon # /usr/share/gnome link if test -d /usr/share/gnome/apps/; then if test -d /usr/share/gnome/apps/Internet/; then if test -w /usr/share/gnome/apps/Internet; then generate_desktop /usr/share/gnome/apps/Internet fi elif test -d /usr/share/gnome/apps/Networking/WWW/; then if test -w /usr/share/gnome/apps/Networking/WWW; then generate_desktop /usr/share/gnome/apps/Networking/WWW fi elif test -w /usr/share/gnome/apps; then mkdir $mkdirv $mkdirp /usr/share/gnome/apps/Internet/ chmod $chmodv 755 /usr/share/gnome/apps/Internet generate_desktop /usr/share/gnome/apps/Internet fi fi # end /usr/share/gnome link fi # Add ximian here } kde() { # This function searches for common kde2 and kde3 icon paths. if test -d /opt/kde${1}/share; then DIR_HI=/opt/kde${1}/share/icons/hicolor if test -d "$DIR_HI" -a -w "$DIR_HI"; then if test -d "$DIR_HI"/48x48/apps -a -w "$DIR_HI"/48x48/apps; then cp $cpv $share_dir/images/opera_48x48.png $DIR_HI/48x48/apps/opera.png; fi if test -d "$DIR_HI"/32x32/apps -a -w "$DIR_HI"/32x32/apps; then cp $cpv $share_dir/images/opera_32x32.png $DIR_HI/32x32/apps/opera.png; fi if test -d "$DIR_HI"/22x22/apps -a -w "$DIR_HI"/22x22/apps; then cp $cpv $share_dir/images/opera_22x22.png $DIR_HI/22x22/apps/opera.png; fi fi DIR_LO=/opt/kde${1}/share/icons/locolor if test -d $DIR_LO -a -w $DIR_LO; then if test -d $DIR_LO/32x32/apps -a -w $DIR_LO/32x32/apps; then cp $cpv $share_dir/images/opera_32x32.png $DIR_LO/32x32/apps/opera.png; fi if test -d $DIR_LO/22x22/apps -a -w $DIR_LO/22x22/apps; then cp $cpv $share_dir/images/opera_22x22.png $DIR_LO/22x22/apps/opera.png; fi if test -d $DIR_LO/16x16/apps -a -w $DIR_LO/16x16/apps; then cp $cpv $share_dir/images/opera_16x16.png $DIR_LO/16x16/apps/opera.png; fi fi if test -d /opt/kde${1}/share/applnk/; then if test ! -d /opt/kde${1}/share/applnk/Internet/ -a -w /opt/kde${1}/share/applnk; then mkdir $mkdirv $mkdirp /opt/kde${1}/share/applnk/Internet/ chmod $chmodv 755 /opt/kde${1}/share/applnk/Internet fi if test -w /opt/kde${1}/share/applnk/Internet; then generate_desktop /opt/kde${1}/share/applnk/Internet ${1}; fi fi fi if test -d /usr/share/applnk/Networking; then if test ! -d /usr/share/applnk/Networking/WWW/ -a -w /usr/share/applnk/Networking; then mkdir $mkdirv $mkdirp /usr/share/applnk/Networking/WWW/ chmod $chmodv 755 /usr/share/applnk/Networking/WWW fi if test -w /usr/share/applnk/Networking/WWW; then generate_desktop /usr/share/applnk/Networking/WWW ${1}; fi fi } kde1() { # This function searches for common kde icon paths. if test -d /opt/kde/share; then if test ! -d /opt/kde/share/icons/ -a -w /opt/kde/share; then mkdir $mkdirv $mkdirp /opt/kde/share/icons/ chmod $chmodv 755 /opt/kde/share/icons fi if test -w /opt/kde/share/icons; then cp $cpv $share_dir/images/opera.xpm /opt/kde/share/icons/opera.xpm;fi if test ! -d /opt/kde/share/applnk/Internet/ -a -w /opt/kde/share/applnk; then mkdir $mkdirv $mkdirp /opt/kde/share/applnk/Internet/ chmod $chmodv 755 /opt/kde/share/applnk/Internet fi if test -w /opt/kde/share/applnk/Internet; then generate_desktop /opt/kde/share/applnk/Internet; fi elif test -d /usr/share/applnk/Internet/ -a -w /usr/share/applnk/Internet; then generate_desktop /usr/share/applnk/Internet fi } mandrake() { if test -x /usr/bin/update-menus; then test ! -d /usr/lib/menu && test -w /usr/lib && mkdir $mkdirv $mkdirp /usr/lib/menu/ test -d /usr/lib/menu -a -w /usr/lib/menu && generate_mdk_menu /usr/lib/menu test ! -d /usr/share/icons && test -w /usr/share && mkdir $mkdirv $mkdirp /usr/share/icons/ && chmod $chmodv 755 /usr/share/icons test -d /usr/share/icons -a -w /usr/share/icons && cp $cpv $share_dir/images/opera_32x32.png /usr/share/icons/opera.png test ! -d /usr/share/icons/mini && test -w /usr/share/icons && mkdir $mkdirv $mkdirp /usr/share/icons/mini/ && chmod $chmodv 755 /usr/share/icons/mini test -d /usr/share/icons/mini -a -w /usr/share/icons/mini && cp $cpv $share_dir/images/opera_16x16.png /usr/share/icons/mini/opera.png test ! -d /usr/share/icons/large && test -w /usr/share/icons && mkdir $mkdirv $mkdirp /usr/share/icons/large && chmod $chmodv 755 /usr/share/icons/large test -d /usr/share/icons/large -a -w /usr/share/icons/large && cp $cpv $share_dir/images/opera_48x48.png /usr/share/icons/large/opera.png /usr/bin/update-menus || true fi } huntdirs() { # $GNOME2PATH and $GNOMEPATH skipped (too few hits google site:gnome.org) # http://docs.kde.org/userguide/environment-variables.html echo ${GNOME2_PATH}:${KDEDIRS}:${GNOME_PATH}:${KDEDIR}:/usr:/opt/gnome:/opt/kde3 \ | tr : '\012' | sed -e 's:$:'"/$1:" } pathdirs() { # Places to look for executables, one per line: echo $PATH | tr : '\012' huntdirs bin } xdg() { # http://standards.freedesktop.org UDD='' for BIN_DIR in `pathdirs`; do test -x ${BIN_DIR}/update-desktop-database || continue UDD=${BIN_DIR}/update-desktop-database; break done # http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html if test "$UDD"; then for ICON_DIR in `echo ${XDG_DATA_DIRS}:/usr/local/share:/usr/share|tr : '\012'|sed -e '/^$/d;s:$:/icons/hicolor:'` /usr/share/pixmaps/hicolor; do test -d ${ICON_DIR} && break done if test ! -d ${ICON_DIR}; then echo "Could not find icon installation directory, icons not installed." >&2 elif test ! -w ${ICON_DIR}; then echo "Directory \"${ICON_DIR}\" not writable by user \"${USER}\", icons not installed." >&2 else for RESOLUTION in 48x48 32x32 22x22; do TO_DIR=${ICON_DIR}/${RESOLUTION}/apps test -d ${TO_DIR} && test -w ${TO_DIR} && cp $cpv $share_dir/images/opera_${RESOLUTION}.png ${TO_DIR}/opera.png done fi for SHORTCUT_DIR in ${XDG_DATA_HOME}/applications /usr/local/share/applications /usr/share/applications; do test -d ${SHORTCUT_DIR} && break; done if test ! -d ${SHORTCUT_DIR}; then echo "Could not find shortcut installation directory, desktop entry not installed." >&2; return elif test ! -w ${SHORTCUT_DIR}; then echo "Directory \"${SHORTCUT_DIR}\" not writable by user \"${USER}\", desktop entry not installed." >&2; return fi generate_desktop ${SHORTCUT_DIR} xdg ${UDD} else icons gnome kde 3 kde 2 kde1 mandrake fi } share_dir=/usr/share/opera/ wrapper_dir=/usr/bin/ xdg preuninstall scriptlet (through /bin/sh): if test "$1" = "0"; then for f in \ ${XDG_DATA_HOME}/applications/opera.desktop \ ${XDG_DATA_DIRS}/icons/hicolor/22x22/apps/opera.png \ ${XDG_DATA_DIRS}/icons/hicolor/32x32/apps/opera.png \ ${XDG_DATA_DIRS}/icons/hicolor/48x48/apps/opera.png \ /etc/X11/wmconfig/opera \ /etc/X11/applnk/Internet/opera.desktop \ /opt/gnome/share/gnome/apps/Internet/opera.desktop \ /opt/gnome/share/pixmaps/opera.xpm \ /opt/kde/share/applnk/Internet/opera.desktop \ /opt/kde/share/icons/opera.xpm \ /opt/kde2/share/applnk/Internet/opera.desktop \ /opt/kde2/share/icons/hicolor/22x22/apps/opera.png \ /opt/kde2/share/icons/hicolor/32x32/apps/opera.png \ /opt/kde2/share/icons/hicolor/48x48/apps/opera.png \ /opt/kde2/share/icons/locolor/16x16/apps/opera.png \ /opt/kde2/share/icons/locolor/22x22/apps/opera.png \ /opt/kde2/share/icons/locolor/32x32/apps/opera.png \ /opt/kde3/share/applnk/Internet/opera.desktop \ /opt/kde3/share/icons/hicolor/22x22/apps/opera.png \ /opt/kde3/share/icons/hicolor/32x32/apps/opera.png \ /opt/kde3/share/icons/hicolor/48x48/apps/opera.png \ /opt/kde3/share/icons/locolor/16x16/apps/opera.png \ /opt/kde3/share/icons/locolor/22x22/apps/opera.png \ /opt/kde3/share/icons/locolor/32x32/apps/opera.png \ /usr/lib/menu/opera \ /usr/local/share/applications/opera.desktop \ /usr/share/applications/opera.desktop \ /usr/share/applnk/Networking/WWW/opera.desktop \ /usr/share/applnk/Internet/opera.desktop \ /usr/share/gnome/apps/Internet/opera.desktop \ /usr/share/icons/opera.xpm \ /usr/share/icons/opera.png \ /usr/share/icons/hicolor/22x22/apps/opera.png \ /usr/share/icons/hicolor/32x32/apps/opera.png \ /usr/share/icons/hicolor/48x48/apps/opera.png \ /usr/share/icons/large/opera.png \ /usr/share/icons/mini/opera.png \ /usr/share/pixmaps/opera.xpm \ /usr/share/pixmaps/hicolor/22x22/apps/opera.png \ /usr/share/pixmaps/hicolor/32x32/apps/opera.png \ /usr/share/pixmaps/hicolor/48x48/apps/opera.png do test -f $f && test -w $f && rm -f $f done if test -L /usr/X11R6/bin/opera then rm -f /usr/X11R6/bin/opera fi fi true postuninstall scriptlet (through /bin/sh): if test "$1" = "0" -a -x /usr/bin/update-menus; then /usr/bin/update-menus || true; fi