summarylogtreecommitdiffstats
path: root/teams-for-linux-wayland-hook.install
blob: 4ed5d6a7d153d07ec7806923a88f1890e3b407f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
post_install() {
    TARGET_PATH="/usr/bin/teams-for-linux"
    EXPECTED_LINK_TARGET="/opt/teams-for-linux/teams-for-linux"

    # Check if the target path is a symlink
    if [ -L "$TARGET_PATH" ] && [ "$(readlink "$TARGET_PATH")" = "$EXPECTED_LINK_TARGET" ]; then
        echo "$TARGET_PATH is a symbolic link to $EXPECTED_LINK_TARGET. Proceeding with replacement."

        # Remove the existing symlink
        rm "$TARGET_PATH"

        # Create a new script to replace the symlink
        echo "#!/bin/bash" > "$TARGET_PATH"
        echo "exec $EXPECTED_LINK_TARGET --enable-features=UseOzonePlatform --ozone-platform=wayland \"\$@\"" >> "$TARGET_PATH"

        # Make the new script executable
        chmod +x "$TARGET_PATH"
    else
        echo "$TARGET_PATH is not a symbolic link to $EXPECTED_LINK_TARGET. No action taken."
    fi
}