Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

beebox / crossover   deb

Repository URL to install this package:

Version: 18.5.0-1 

/ opt / cxoffice / share / crossover / cxrepackage / deb.postinst

#!/bin/sh
# (c) Copyright 2002-2008, 2011. CodeWeavers, Inc.
set -e

# Setup logging
if [ -n "$CX_LOG" ]
then
    [ "$CX_LOG" = "-" ] || exec 2>>"$CX_LOG"
    echo >&2
    echo "***** `date`" >&2
    echo "Starting: $0 $@" >&2
    set -x
fi

action="$1"
oldver="$2"

CX_ROOT="/opt/@product_id@"
export CX_ROOT

if [ "$mode" = "install" ]
then
    if [ -z "$CX_PRODUCT_ID" ]
    then
        CX_PRODUCT_ID="@product_id@"
    fi
elif [ -f "$CX_ROOT/.productid" ]
then
    CX_PRODUCT_ID=`cat "$CX_ROOT/.productid"`
else
    CX_PRODUCT_ID="@product_id@"
fi
productid="$CX_PRODUCT_ID"
package="deb:$DPKG_MAINTSCRIPT_PACKAGE"

if [ "$action" = "configure" ]
then
    if [ -n "$oldver" -o -f "$CX_ROOT/etc/$productid.conf" ]
    then
        mode="upgrade"
    else
        mode="install"
    fi

# This script expects package, CX_ROOT, productid, mode and oldver to be set


builtin_product_id="cxoffice"
if [ "$mode" = "install" ]
then
    if [ "$productid" != "$builtin_product_id" ]
    then
        echo "$productid" >"$CX_ROOT/.productid"
    else
        rm -f "$CX_ROOT/.productid"
    fi
fi

uid=`perl -e 'print $>'`

unset HOME

# These files are no longer needed (were used by version 4.x)
if [ "$uid" = "0" -a -f "/sbin/conf.d/SuSEconfig.zz$productid-vfolders" ]
then
    rm -f "/sbin/conf.d/SuSEconfig.zz$productid-vfolders"
fi
rm -f "$CX_ROOT/lib/xml/libperl.so.5.8"

# Icons have moved to share/icons
rm -f "$CX_ROOT"/support/*.png

# We don't need the 2007 DST bottle hook anymore
rm -f "$CX_ROOT"/support/scripts.d/??.dst2007patch
rmdir "$CX_ROOT"/support/scripts.d 2>/dev/null || true

# Try to set up the security context if possible (especially for Fedora).
# Do so before potentially trying to upgrade bottles.
setup_selinux()
{
    # Note that this may or may not work depending on obscure system settings.
    # So try chcon on the landmark file and don't abort if that fails.
    if chcon system_u:object_r:bin_t:s0 "$CX_ROOT"/bin/cxmenu
    then
        ( cd "$CX_ROOT"/bin && find * -type d -prune -o -type f \
            -exec chcon system_u:object_r:bin_t:s0 {} \; )
        ( cd "$CX_ROOT"/lib && find * -type d -prune -o -type f \
            -exec chcon system_u:object_r:lib_t:s0 {} \; )
        if chcon system_u:object_r:wine_exec_t:s0 "$CX_ROOT"/bin/wine-preloader
        then
            chcon system_u:object_r:wine_exec_t:s0 "$CX_ROOT"/bin/wineloader
        fi
        if chcon system_u:object_r:textrel_shlib_t:s0 "$CX_ROOT"/lib/wine/ntdll.dll.so
        then
            setype="textrel_shlib_t"
        else
            setype="lib_t"
        fi
        ( cd "$CX_ROOT"/lib/wine && find * -type d -prune -o -type f \
            -exec chcon system_u:object_r:$setype:s0 {} \; )
    fi
}
if [ -z "$CX_LOG" ]
then
    setup_selinux 2>/dev/null
else
    setup_selinux
fi


# Update wineserver symlink as appropriate
if [ -L "$CX_ROOT/bin/wineserver" ]
then
    rm "$CX_ROOT/bin/wineserver"
    if "$CX_ROOT/bin/wineserver64" -v >/dev/null 2>/dev/null
    then
        ln -s wineserver64 "$CX_ROOT/bin/wineserver"
    else
        ln -s wineserver32 "$CX_ROOT/bin/wineserver"
    fi
fi


# Create or upgrade the configuration file and more
if [ -f "$CX_ROOT/.uninstalled" ]
then
    rm -f "$CX_ROOT/.uninstalled"
    install_bottles="--install-bottles"
else
    install_bottles=""
fi
"$CX_ROOT/lib/cxupgrade" --package "$package" --productid "$productid" --old-version "$oldver" $install_bottles
"$CX_ROOT/bin/cxtie" --register

if [ "$mode" = "install" -a "$uid" = "0" ]
then
    chmod 0644 "$CX_ROOT/etc/$productid.conf"
fi

fi

#DEBHELPER#