1843200
  0   ˆl–Ým_Jõ2ÛR‚ „ …q–î	Å1hßÁ918_ŒuÐb&=LyYÿÁÀ –    #!/usr/bin/sh

# This script is sourced, so root should be set. But let's be paranoid
[ -z "$root" ] && root=$(getarg root=)

if [ -z "$netroot" ]; then
    for netroot in $(getargs netroot=); do
        [ "$netroot" = "dhcp" ] && break
        [ "$netroot" = "dhcp6" ] && break
    done
    [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] || unset netroot
fi

if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ]; then
    # Tell ip= checker that we need dhcp
    # shellcheck disable=SC2034
    NEEDDHCP="1"

    # Done, all good!
    # shellcheck disable=SC2034
    rootok=1
    if [ "$netroot" != "dhcp" ] && [ "$netroot" != "dhcp6" ]; then
        netroot=$root
    fi

    # Shut up init error check
    [ -z "$root" ] && root="dhcp"
    # shellcheck disable=SC2016
    echo '[ -d $NEWROOT/proc -o -e /dev/root ]' > "$hookdir"/initqueue/finished/dhcp.sh
fi
  "   ˆl–ßi~”*i?u8 \¸\TÅ£ÃƒiÀƒÂÁ     #!/usr/bin/bash

#
# Copyright (C) 2018 Red Hat, Inc.
# SPDX-License-Identifier: LGPL-2.1-or-later


# Run a local bridge, web server, and browser for a particular Cockpit page.
# This is useful for integration into .desktop files, for systems which don't
# have cockpit.socket enabled. The web server and browser run in an unshared
# network namespace, and thus are totally isolated from everything else.
#
# Examples:
#   cockpit-desktop /cockpit/@localhost/system/index.html
#   cockpit-desktop network/firewall
#   cockpit-desktop users
#
# As an experimental/demo feature, the bridge can also be started on a remote
# ssh host. The host name is given as (optional) second argument, which is
# passed verbatim to ssh.
#
# Example:
#   cockpit-desktop system svr1
#   cockpit-desktop / username@svr1
set -eu

# shellcheck disable=SC2034 # exec_prefix= is set because the default /usr/libexec contains "${exec_prefix}"
exec_prefix="/usr"

# start browser in a temporary home dir, so that it does not interfere with your real one
BROWSER_HOME=$(mktemp --directory --tmpdir cockpit.desktop.XXXXXX)
export BROWSER_HOME

# find suitable browser, unless already set by $BROWSER
# We can't use xdg-open, it does too much magic behind the back to connect to
# existing instances (outside of our namespace) and does not allow us to reduce
# the UI, or pass options like chromium's --no-sandbox.
detect_browser()
{
    [ -z "${BROWSER:-}" ] || return 0

    # First choice, but it depends on gi.repository WebKit2, so check it
    if /usr/libexec/cockpit-client --help >/dev/null 2>/dev/null; then
        BROWSER="/usr/libexec/cockpit-client --disable-uniqueness --no-ui --external-ws"
        return 0
    fi

    for browser in chromium-browser chromium google-chrome; do
        if type $browser >/dev/null 2>&1; then
            # need to disable sandboxing in user namespace, but that already isolates
            # TODO: Find a way to disable the URL bar
            BROWSER="$browser --no-sandbox --disable-infobars"
            return 0
        fi
    done

    # create firefox profile
    FIREFOX_PROFILE="$BROWSER_HOME/profile"
    mkdir "$FIREFOX_PROFILE"
    cat <<EOF > "$FIREFOX_PROFILE/user.js"
user_pref("datareporting.policy.dataSubmissionEnabled", false);
user_pref("toolkit.telemetry.reportingpolicy.firstRun", false);
user_pref("browser.toolbars.bookmarks.visibility", "never");
EOF

    if type firefox >/dev/null 2>&1; then
        # TODO: Find a way to disable the URL bar
        BROWSER="firefox --profile $FIREFOX_PROFILE --no-remote"
        return 0
    fi

    for id in org.mozilla.firefox org.mozilla.Firefox; do
        if flatpak info $id >/dev/null 2>&1; then
            BROWSER="flatpak run --filesystem=$BROWSER_HOME $id --profile $FIREFOX_PROFILE --no-remote"
            return 0
        fi
    done

    # TODO: is there a simple way to use webkitgtk?
    echo "No suitable browser found (Chromium/Chrome, or Firefox)" >&2
    exit 1
}


if [ -z "${1:-}" ]; then
    echo "Usage: $0 <Cockpit path> [ssh host]" >&2
   