post_install() { # Add icons to the system icons XDG_ICON_RESOURCE="`which xdg-icon-resource 2> /dev/null || true`" if [ ! -x "$XDG_ICON_RESOURCE" ]; then echo "Error: Could not find xdg-icon-resource" >&2 exit 1 fi for icon in product_logo_48.png product_logo_24.png product_logo_256.png product_logo_16.png product_logo_64.png product_logo_128.png product_logo_32.png ; do size="$(echo ${icon} | sed 's/[^0-9]//g')" "$XDG_ICON_RESOURCE" install --size "${size}" "/opt/bytedance/feishu/${icon}" \ "bytedance-feishu" done UPDATE_MENUS="`which update-mime-database usr/share/mime &> /dev/null 2> /dev/null || true`" if [ -x "$UPDATE_MENUS" ]; then update-mime-database usr/share/mime &> /dev/null fi # Update cache of .desktop file MIME types. Non-fatal since it's just a cache. update-desktop-database > /dev/null 2>&1 || true NSS_FILES="libnspr4.so.0d libplds4.so.0d libplc4.so.0d libssl3.so.1d \ libnss3.so.1d libsmime3.so.1d libnssutil3.so.1d" add_nss_symlinks() { get_lib_dir for f in $NSS_FILES do target=$(echo $f | sed 's/\.[01]d$//') if [ -f "/$LIBDIR/$target" ]; then ln -snf "/$LIBDIR/$target" "/opt/bytedance/feishu/$f" elif [ -f "/usr/$LIBDIR/$target" ]; then ln -snf "/usr/$LIBDIR/$target" "/opt/bytedance/feishu/$f" else echo $f not found in "/$LIBDIR/$target" or "/usr/$LIBDIR/$target". exit 1 fi done } remove_nss_symlinks() { for f in $NSS_FILES do rm -rf "/opt/bytedance/feishu/$f" done } remove_udev_symlinks() { rm -rf "/opt/bytedance/feishu/libudev.so.0" } remove_udev_symlinks } post_upgrade() { post_install } pre_remove() { action="$1" if [ "$2" = "in-favour" ]; then # Treat conflict remove as an upgrade. action="upgrade" fi # Don't clean-up just for an upgrade.` if [ "$action" = "upgrade" ] ; then return fi # Remove icons from the system icons XDG_ICON_RESOURCE="`which xdg-icon-resource 2> /dev/null || true`" if [ ! -x "$XDG_ICON_RESOURCE" ]; then echo "Error: Could not find xdg-icon-resource" >&2 exit 1 fi for icon in product_logo_48.png product_logo_24.png product_logo_256.png product_logo_16.png product_logo_64.png product_logo_128.png product_logo_32.png ; do size="$(echo ${icon} | sed 's/[^0-9]//g')" "$XDG_ICON_RESOURCE" uninstall --size "${size}" "bytedance-feishu" done UPDATE_MENUS="`which update-mime-database usr/share/mime &> /dev/null 2> /dev/null || true`" if [ -x "$UPDATE_MENUS" ]; then update-mime-database usr/share/mime &> /dev/null fi # Update cache of .desktop file MIME types. Non-fatal since it's just a cache. update-desktop-database > /dev/null 2>&1 || true } post_remove() { action="$1" # Only do complete clean-up on purge. if [ "$action" != "purge" ] ; then return fi NSS_FILES="libnspr4.so.0d libplds4.so.0d libplc4.so.0d libssl3.so.1d \ libnss3.so.1d libsmime3.so.1d libnssutil3.so.1d" add_nss_symlinks() { get_lib_dir for f in $NSS_FILES do target=$(echo $f | sed 's/\.[01]d$//') if [ -f "/$LIBDIR/$target" ]; then ln -snf "/$LIBDIR/$target" "/opt/bytedance/feishu/$f" elif [ -f "/usr/$LIBDIR/$target" ]; then ln -snf "/usr/$LIBDIR/$target" "/opt/bytedance/feishu/$f" else echo $f not found in "/$LIBDIR/$target" or "/usr/$LIBDIR/$target". exit 1 fi done } { for f in $NSS_FILES do rm -rf "/opt/bytedance/feishu/$f" done } { rm -rf "/opt/bytedance/feishu/libudev.so.0" } remove_udev_symlinks }