keybase-client-skills
Development skills for the Keybase client repo
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Check it deeper on your machine
It has changed since its scan on 11 Nov 2026. Its scripts were only partly scanned.
As a Claude Code plugin, install it and then ask Claude Code:
/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/keybase/client with scanskillsafety
Or from a terminal, clone it and run it:
git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/keybase/client'
It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.
Badge for your README
Markdown
[](/listings/keybase--client)HTML
<a href="/listings/keybase--client"><img src="/api/listings/keybase--client/badge.svg" alt="findsafeskills safety rating" /></a>Install
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
.claude-plugin/plugin.json · Manifest · 4 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
- {
- "name": "keybase-client-skills",
- "description": "Development skills for the Keybase client repo"
- }
README.md · README · 88 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
- ## Keybase
- Hi, and welcome to the Keybase client repo. All our client apps (macOS,
- Windows, Linux, iOS, and Android) are being actively developed in this
- repository. Please, dig around.
- ### Warnings
- We'd love you to read our source code.
- But - some of the things in this repo are explorations, and the app you build
- from source just _might not do what it says it's doing_. So, if you just want
- to install Keybase on your computer, you should **[monitor our releases](https://keybase.io/download)** for macOS, Linux, or Windows.
- If you're interested in our Docker image releases, please check out **[the Docker README](packaging/linux/docker/README.md)**.
- 
- ### Code Layout
- - **go**: Core crypto libraries; the Keybase service; the command line client. [Learn More](go/README.md)
- - **shared/{android,ios}**: Android and iOS apps developed with [React Native](https://facebook.github.io/react-native/).
- - **shared/desktop**: Desktop application for macOS, Linux, and Windows, made with the [Electron](https://github.com/atom/electron) framework, sharing React code with react-native.
- - **packaging**: Scripts for releasing packages across the various platforms.
- - **protocol**: Defines the protocol for communication for clients to the Keybase services. Uses [Avro](http://avro.apache.org/docs/1.7.7/). [Learn More](protocol/README.md)
- - **media**: Icons, graphics, media for Keybase apps.
- - **osx**: The macOS Keybase.app, development parallel to an Electron-based application above. [Learn More](osx/README.md)
- ### Problems?
- Report any issues with client software on this GitHub
- [issue tracker](https://github.com/keybase/client/issues).
- Internally, we track our progress using Jira, but all PRs come through GitHub
- for your review!
- If you're having problems with the command line `keybase` client, take a
- look at [the troubleshooting doc](go/doc/troubleshooting.md).
- If you're having problems with our Website, try the
- [keybase-issues](https://github.com/keybase/keybase-issues) issue tracker.
- We check and update both frequently.
- ### License
- Most code is released under the New BSD (3 Clause) License. If subdirectories
- include a different license, that license applies instead.
- ### Development Guidelines
- We check all git commits with pre-commit hooks generated via
- [pre-commit.com](http://pre-commit.com) pre-commit hooks.
- To enable use of these pre-commit hooks:
- - [Install](http://pre-commit.com/#install) the `pre-commit` utility. For some common cases:
- - `pip install pre-commit`
- - `brew install pre-commit`
- - Remove any existing pre-commit hooks via `rm .git/hooks/pre-commit`
- - Configure via `pre-commit install`
- Then proceed as normal.
- #### External Contributors
- If you forked this repository on GitHub and made a PR, then it'll show up as
- having failed Jenkins CI. We do not build external PRs because it's a security
- risk to do so without a review first. If your PR is successfully reviewed by a
- member of the Keybase team, then we will merge your commits to a branch on our
- primary fork and build from there.
- ### Cryptography Notice
- This distribution includes cryptographic software. The country in which you
- currently reside may have restrictions on the import, possession, use, and/or
- re-export to another country, of encryption software. BEFORE using any
- encryption software, please check your country's laws, regulations and policies
- concerning the import, possession, or use, and re-export of encryption
- software, to see if this is permitted. See http://www.wassenaar.org/ for more
- information.
- The U.S. Government Department of Commerce, Bureau of Industry and Security
- (BIS), has classified this software as Export Commodity Control Number (ECCN)
- 5D002.C.1, which includes information security software using or performing
- cryptographic functions with asymmetric algorithms. The form and manner of this
- distribution makes it eligible for export under the License Exception ENC
- Technology Software Unrestricted (TSU) exception (see the BIS Export
- Administration Regulations, Section 740.13) for both object code and source
- code.
osx/Fuse/install.sh · Bundled script · 25 lines · 1 finding marked
- #!/usr/bin/env bash
- set -e -u -o pipefail # Fail on error
- dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
- cd "$dir"
- bundle=${BUNDLE:-"kbfuse.bundle"}
- dest="/Library/Filesystems/kbfuse.fs"
- echo "Using bundle: $bundle"
- # Uninstall if present. This will fail if there are current kbfuse mounts.
- if [ -d "$dest" ]; then
- echo "Uninstalling $dest..."
- "$dir/uninstall.sh"
- fi
- echo "Installing $dest..."
- sudo /bin/cp -RfX "$bundle" "$dest"
- sudo chmod +s "/Library/Filesystems/kbfuse.fs/Contents/Resources/load_kbfuse"
- Warning: Sets the setuid bit, so the program runs with its owner's rights
- Line 21 on GitHub
- echo "Loading kext..."
- /Library/Filesystems/kbfuse.fs/Contents/Resources/load_kbfuse
- kextstat | grep kbfuse
packaging/linux/build_binaries.sh · Bundled script · 196 lines · 1 finding marked
- #! /usr/bin/env bash
- set -euox pipefail
- # check host arch
- is_arm64_host() {
- [[ $(uname -m) == "arm64" ]] || [[ $(uname -m) == "aarch64" ]]
- }
- here="$(dirname "${BASH_SOURCE[0]}")"
- this_repo="$(git -C "$here" rev-parse --show-toplevel ||
- echo -n "$GOPATH/src/github.com/keybase/client")"
- client_dir="$here/../../go"
- mode="$("$here/../build_mode.sh" "$@")"
- binary_name="$("$here/../binary_name.sh" "$@")"
- # Take the second argument as the build root, or a tmp dir if there is no
- # second argument. Absolutify the build root, because we cd around in this
- # script, and also because GOPATH is not allowed to be relative.
- build_root="${2:-/tmp/keybase_build_$(date +%Y_%m_%d_%H%M%S)}"
- mkdir -p "$build_root"
- build_root="$(realpath "$build_root")"
- # Record the version now, and write it to the build root. Because it uses a
- # timestamp in prerelease mode, it's important that other scripts use this file
- # instead of recomputing the version themselves.
- version="$("$here/../version.sh" "$@")"
- echo -n "$version" >"$build_root/VERSION"
- echo -n "$mode" >"$build_root/MODE"
- echo "Building version $version $mode in $build_root"
- # Determine the Go tags.
- go_tags=""
- if [ "$mode" = "production" ]; then
- go_tags="production"
- elif [ "$mode" = "prerelease" ]; then
- go_tags="production prerelease"
- elif [ "$mode" = "staging" ]; then
- go_tags="staging"
- fi
- echo "-tags '$go_tags'"
- # Determine the LD flags.
- buildmode="pie"
- ldflags_client=""
- ldflags_kbfs=""
- strip_flag=" -s -w "
- if [ "$mode" != "production" ]; then
- # The non-production build number is everything in the version after the hyphen.
- build_number="$(echo -n "$version" | sed 's/.*-//')"
- ldflags_client="$strip_flag -X github.com/keybase/client/go/libkb.PrereleaseBuild=$build_number"
- ldflags_kbfs="$strip_flag -X github.com/keybase/client/go/kbfs/libkbfs.PrereleaseBuild=$build_number"
- fi
- echo "-ldflags_client '$ldflags_client'"
- echo "-ldflags_kbfs '$ldflags_kbfs'"
- should_build_kbfs() {
- [ "$mode" != "production" ] && [[ ! -v KEYBASE_NO_KBFS ]]
- }
- should_build_electron() {
- [ "$mode" != "production" ] && [[ ! -v KEYBASE_NO_GUI ]]
- }
- # Install the electron dependencies.
- if should_build_electron; then
- echo "Installing Node modules for Electron"
- # Can't seem to get the right packages installed under NODE_ENV=production.
- export NODE_ENV=development
- export KEYBASE_SKIP_DEV_TOOLS=1
- (cd "$this_repo/shared" && yarn modules)
- unset KEYBASE_SKIP_DEV_TOOLS
- export NODE_ENV=production
- fi
- build_one_architecture() {
- layout_dir="$build_root/binaries/$debian_arch"
- mkdir -p "$layout_dir/usr/bin"
- # Assemble a custom GOPATH. Symlinks work for us here, because both the
- # client repo and the kbfs repo are fully vendored.
- export GOPATH="$build_root/gopaths/$debian_arch"
- mkdir -p "$GOPATH/src/github.com/keybase"
- ln -snf "$this_repo" "$GOPATH/src/github.com/keybase/client"
- # Build the client binary. Note that `go build` reads $GOARCH.
- echo "Building client for $GOARCH..."
- (cd "$client_dir" && go build -tags "$go_tags" -ldflags "$ldflags_client" -buildmode="$buildmode" -o \
- "$layout_dir/usr/bin/$binary_name" github.com/keybase/client/go/keybase)
- # Short-circuit if we're not building electron.
- if ! should_build_kbfs; then
- echo "SKIPPING kbfs and electron."
- return
- fi
- cp "$here/run_keybase" "$layout_dir/usr/bin/"
- # In include-KBFS mode, create the /opt/keybase dir, and include post_install.sh.
- mkdir -p "$layout_dir/opt/keybase"
- cp "$here/post_install.sh" "$layout_dir/opt/keybase/"
- cp "$here/crypto_squirrel.txt" "$layout_dir/opt/keybase/"
- # Build the kbfsfuse binary. Currently, this always builds from master.
- echo "Building kbfs for $GOARCH..."
- (cd "$client_dir" && go build -tags "$go_tags" -ldflags "$ldflags_kbfs" -buildmode="$buildmode" -o \
- "$layout_dir/usr/bin/kbfsfuse" github.com/keybase/client/go/kbfs/kbfsfuse)
- # Build the git-remote-keybase binary, also from the kbfs repo.
- echo "Building git-remote-keybase for $GOARCH..."
- (cd "$client_dir" && go build -tags "$go_tags" -ldflags "$ldflags_kbfs" -buildmode="$buildmode" -o \
- "$layout_dir/usr/bin/git-remote-keybase" github.com/keybase/client/go/kbfs/kbfsgit/git-remote-keybase)
- # Short-circuit if we're doing a Docker multi-stage build
- if ! should_build_electron; then
- echo "SKIPPING electron."
- return
- fi
- # Build the root redirector binary.
- echo "Building keybase-redirector for $GOARCH..."
- (cd "$client_dir" && CGO_ENABLED=1 go build -tags "$go_tags" -ldflags "$ldflags_client" -buildmode="$buildmode" -o \
- "$layout_dir/usr/bin/keybase-redirector" github.com/keybase/client/go/kbfs/redirector)
- # Build Electron.
- echo "Building Electron client for $electron_arch..."
- (
- cd "$this_repo/shared"
- yarn run desktop:package -- --platform=linux --arch="$electron_arch" --appVersion="$version" --network-concurrency=8
- rsync -a "desktop/release/linux-${electron_arch}/Keybase-linux-${electron_arch}/" \
- "$layout_dir/opt/keybase"
- chmod 755 "$layout_dir/opt/keybase"
- chmod 4755 "$layout_dir/opt/keybase/chrome-sandbox"
- Note: Sets the setuid bit, so the program runs with its owner's rights
- Line 134 on GitHub
- )
- # Copy in the icon images and .saltpack file images.
- for size in 16 32 128 256 512; do
- icon_dest="$layout_dir/usr/share/icons/hicolor/${size}x${size}/apps"
- saltpack_dest="$layout_dir/usr/share/icons/hicolor/${size}x${size}/mimetypes"
- mkdir -p "$icon_dest"
- cp "$this_repo/media/icons/Keybase.iconset/icon_${size}x${size}.png" "$icon_dest/keybase.png"
- mkdir -p "$saltpack_dest"
- cp "$this_repo/media/icons/Saltpack.iconset/icon_${size}x${size}.png" "$saltpack_dest/application-x-saltpack.png"
- done
- # Copy in the desktop entry. Note that this is different from the autostart
- # entry, which will be created per-user the first time the service runs.
- apps_dir="$layout_dir/usr/share/applications"
- mkdir -p "$apps_dir"
- cp "$here/keybase.desktop" "$apps_dir"
- # Copy in the Saltpack file extension MIME type association.
- apps_dir="$layout_dir/usr/share/mime/packages"
- mkdir -p "$apps_dir"
- cp "$here/x-saltpack.xml" "$apps_dir"
- # Copy in the systemd unit files.
- units_dir="$layout_dir/usr/lib/systemd/user"
- mkdir -p "$units_dir"
- cp "$here/systemd"/* "$units_dir"
- # Check for whitespace in all the filenames we've copied. We don't support
- # whitespace in our later build scripts (for example RPM packaging), and even
- # if we did, it would be bad practice to use it.
- if (find "$layout_dir" | grep " "); then
- echo 'ERROR: whitespace in filenames! (shown above)'
- exit 1
- fi
- }
- if [ -n "${KEYBASE_BUILD_ARM_ONLY:-}" ]; then
- echo "Keybase: Building for ARM only"
- export GOARCH=arm64
- export debian_arch=arm64
- export electron_arch=arm64
- build_one_architecture
- echo "Keybase: Built ARM; exiting..."
- exit
- fi
- if [ -z "${KEYBASE_SKIP_64_BIT:-}" ]; then
- if is_arm64_host; then
- echo "Keybase: Building for x86-64 (arm64 host cross compile)"
- export CC=x86_64-linux-gnu-gcc
- export CXX=x86_64-linux-gnu-g++
- else
- echo "Keybase: Building for x86-64"
- fi
- export GOARCH=amd64
- export debian_arch=amd64
- export electron_arch=x64
- build_one_architecture
- else
- echo SKIPPING 64-bit build
- fi
packaging/linux/post_install.sh · Bundled script · 280 lines · 1 finding marked
- #! /usr/bin/env bash
- # This script handles distro-independent Linux post-install tasks. Currently
- # that means managing the /keybase redirector mountpoint. The deb-
- # and rpm-specific post-install scripts call into this after doing their
- # distro-specific work, which is mainly setting up package repos for updates.
- # The script also attempts to restart services if the mountpoint is not being used.
- # To disable this behavior, create /etc/keybase/config.json if it doesn't exist
- # and add the key value pair { "disable-autorestart": true }.
- set -u
- rootmount="/keybase"
- krbin="/usr/bin/keybase-redirector"
- BASH=$(command -v bash)
- redirector_enabled() {
- keybase --use-root-config-file config get --direct --assert-false --assert-ok-on-nil disable-root-redirector &> /dev/null
- }
- autorestart_enabled() {
- keybase --use-root-config-file config get --direct --assert-false --assert-ok-on-nil disable-autorestart &> /dev/null
- }
- make_mountpoint() {
- local_is_redirector_enabled="$1"
- if [ -n "$local_is_redirector_enabled" ]; then
- if ! mountpoint "$rootmount" &> /dev/null; then
- mkdir -p "$rootmount"
- chown root:root "$rootmount"
- chmod 755 "$rootmount"
- fi
- fi
- }
- systemd_exec_as() {
- user=$1
- shift
- # Keybase supports running with and without systemd. In order for `su`
- # to work with systemd commands, we need to pass in XDG_RUNTIME_DIR.
- # /run/user/{uid} is the default when using systemd. We can't know the
- # true value without installing systemd itself, which we don't want to
- # depend on, so we use this default. Users who want to use a custom
- # XDG_RUNTIME_DIR should specify it in their .profile so it is known
- # by su -, which doesn't load pam_systemd. Unfortunately, this also
- # results in an extra su invocation.
- user_xdg_runtime_dir=""
- # shellcheck disable=SC2016
- # Intentionally do not expand $XDG_RUNTIME_DIR; we want the user's shell to expand it
- if ! user_xdg_runtime_dir="$(su -s "$BASH" --login "$user" -c 'echo $XDG_RUNTIME_DIR')" || [ -z "$user_xdg_runtime_dir" ]; then
- user_xdg_runtime_dir="/run/user/$(id -u "$user")" || return 1
- fi
- # To support restarting without systemd, we'd also have to pass in DISPLAY,
- # but there's no easy way to figure that out.
- # With run_keybase, we pipe environment variables to the user's runtime directory,
- # so Keybase units will get the necessary environment from there, even though this su
- # shell doesn't have, e.g., DISPLAY.
- su --login "$user" -s "$BASH" -c "XDG_RUNTIME_DIR=$user_xdg_runtime_dir $* 2> /dev/null"
- }
- # Exits with 0 iff the given user is running the service with systemd
- systemd_unit_active_for() {
- user=$1
- service=$2
- command -v systemctl &> /dev/null && systemd_exec_as "$user" "systemctl --user -q is-active $service"
- }
- SYSTEMD_RESTARTED_REDIRECTOR=
- systemd_restart_if_active() {
- user=$1
- service=$2
- if systemd_unit_active_for "$user" "$service"; then
- systemd_exec_as "$user" "systemctl --user restart $service"
- if [ "$service" = "keybase-redirector.service" ]; then
- SYSTEMD_RESTARTED_REDIRECTOR=1
- fi
- fi
- }
- safe_restart_systemd_services() {
- if ! autorestart_enabled; then
- echo "Keybase autorestart disabled. Restart manually by running 'run_keybase' for each user using Keybase."
- return 0
- fi
- while read -r pid; do
- if [ -z "$pid" ]; then
- continue
- fi
- # Since keybase is running, we can assume run_keybase has been run before
- # and the mountdir is configured (so, it is not a fresh install).
- user="$(ps -o user= -p "$pid")"
- # If the process terminated since the loop started somehow, skip
- # restarting
- if [ -z "$user" ]; then
- continue
- fi
- restart_instructions="Restart Keybase manually by running 'run_keybase' as $user."
- abort_instructions="Aborting Keybase autorestart for $user. $restart_instructions"
- if ! systemd_unit_active_for "$user" "keybase.service"; then
- echo "Keybase not running via systemd for $user."
- echo "$restart_instructions"
- continue
- fi
- if systemd_unit_active_for "$user" "kbfs.service"; then
- if ! mount="$(systemd_exec_as "$user" "/usr/bin/keybase config get --direct --bare mountdir")" || [ -z "$mount" ]; then
- echo "Could not find mountdir for $user via systemd."
- echo "$abort_instructions"
- continue
- fi
- # Mount found, abort autorestart for user if currently being used.
- # lsof exits with zero iff there are no errors and mount is being used
- # Be slightly aggressive and restart if lsof did hit errors (e.g., if mount didn't exist)
- if lsof_output="$(systemd_exec_as "$user" "lsof $mount" 2> /dev/null)"; then
- programs_accessing_mount="$(echo "$lsof_output" | tail -n +2 | awk '{print $1}' | tr '\n' ', ')"
- echo "KBFS mount $mount for user $user currently in use by ($programs_accessing_mount)."
- echo "Please stop these processes before restarting manually."
- echo "$abort_instructions"
- continue
- fi
- fi
- echo "Autorestarting Keybase via systemd for $user."
- # Reload possibly-new systemd unit files first
- systemd_exec_as "$user" "systemctl --user daemon-reload"
- systemd_restart_if_active "$user" "keybase.service"
- systemd_restart_if_active "$user" "kbfs.service"
- systemd_restart_if_active "$user" "keybase.gui.service"
- systemd_restart_if_active "$user" "keybase-redirector.service"
- done <<< "$(pidof /usr/bin/keybase | tr ' ' '\n')"
- }
- is_owned_by_root() {
- owner_uid="$(stat --format=%u "$1" 2> /dev/null)" && [ "0" = "$owner_uid" ]
- }
- # In 4.3.0, 4.3.1, we had a bug where this post install script's usage of
- # Keybase commands would create .config/keybase/ with root permissions if it
- # didn't already exist.
- fix_bad_config_perms() {
- if userhomes=$(find /home -maxdepth 1 -mindepth 1 -type d); then
- while read -r userhome; do
- user="$(basename "$userhome")"
- # Don't attempt to fix for users with custom XDG_CONFIG_HOME,
- # hopefully they will read release notes.
- configdir="/home/$user/.config"
- keybase_configdir="$configdir/keybase"
- keybase_configfile="$configdir/keybase/gui_config.json"
- if [ -e "$keybase_configdir" ]; then
- if is_owned_by_root "$configdir"; then
- echo "Fixing bad permissions in $configdir; try 'run_keybase' after install."
- chown -R "$user:$user" "$configdir"
- elif is_owned_by_root "$keybase_configdir"; then
- echo "Fixing bad permissions in $keybase_configdir; try 'run_keybase' after install."
- chown -R "$user:$user" "$keybase_configdir"
- elif is_owned_by_root "$keybase_configfile"; then
- echo "Fixing bad permissions in $keybase_configfile; try 'run_keybase' after install."
- chown -R "$user:$user" "$keybase_configfile"
- fi
- fi
- done <<< "$userhomes"
- fi
- }
- fix_bad_config_perms
- # Associate Keybase with .saltpack files.
- if command -v update-mime-database &> /dev/null ; then
- update-mime-database /usr/share/mime
- fi
- # Update the GTK icon cache, if possible.
- if command -v gtk-update-icon-cache &> /dev/null ; then
- gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor
- fi
- is_redirector_enabled=""
- if redirector_enabled; then
- is_redirector_enabled="1"
- fi
- # Set suid on redirector before we restart it, in case package manager reverted
- # permissions.
- if [ -n "$is_redirector_enabled" ]; then
- chown root:root "$krbin"
- chmod 4755 "$krbin"
- Note: Sets the setuid bit, so the program runs with its owner's rights
- Line 195 on GitHub
- else
- # Turn off suid if root has been turned off.
- chmod a-s "$krbin"
- fi
- # Restart services before restarting redirector manually
- # so we know if it was already restarted via systemd.
- safe_restart_systemd_services
- currlink="$(readlink "$rootmount")"
- if [ -n "$currlink" ] ; then
- # Follow the symlink one level deep if needed, to account for the
- # mount1 link.
- nextlink="$(readlink "$currlink")"
- if [ -n "$nextlink" ]; then
- currlink="$nextlink"
- fi
- # Upgrade from a rootlink-based build.
- if rm "$rootmount" &> /dev/null ; then
- echo Replacing old $rootmount symlink.
- fi
- elif [ -d "$rootmount" ] ; then
- # Handle upgrading from old builds that don't have the rootlink.
- currowner="$(stat -c %U "$rootmount")"
- if [ "$currowner" != "root" ]; then
- # Remove any existing legacy mount.
- echo Unmounting $rootmount...
- if killall kbfsfuse &> /dev/null ; then
- echo Shutting down kbfsfuse...
- fi
- rmdir "$rootmount"
- echo You must run run_keybase to restore file system access.
- elif [ -z "$is_redirector_enabled" ]; then
- if killall "$(basename "$krbin")" &> /dev/null ; then
- echo "Stopping existing root redirector."
- fi
- elif [ -n "$SYSTEMD_RESTARTED_REDIRECTOR" ]; then
- echo "Restarted existing root redirector via systemd."
- elif killall -USR1 "$(basename "$krbin")" &> /dev/null ; then
- echo "Restarting existing root redirector."
- # If the redirector is still owned by root, that probably
- # means we're sill running an old version and it needs to be
- # manually killed and restarted. Instead, run it as the user
- # currently running kbfsfuse.
- krName="$(basename "$krbin")"
- krUser="$(ps -o user= -C "$krName" 2> /dev/null | head -1)"
- if [ "$krUser" = "root" ]; then
- newUser="$(ps -o user= -C "kbfsfuse" 2> /dev/null | head -1)"
- killall "$krName" &> /dev/null
- if [ -n "$newUser" ] && [ "$newUser" != "root" ]; then
- # Try our best to get the user's $XDG_CACHE_HOME,
- # though depending on how it's set, it might not be
- # available to su.
- userCacheHome="$(su -s "$BASH" -c "echo -n \$XDG_CACHE_HOME" - "$newUser")"
- log="${userCacheHome:-~$newUser/.cache}/keybase/keybase.redirector.log"
- su -s "$BASH" -c "nohup \"$krbin\" \"$rootmount\" &>> $log &" "$newUser"
- echo "Root redirector now running as $newUser."
- else
- # The redirector is running as root, and either root
- # is running kbfsfuse, or no one is. In either case,
- # just make sure it restarts (since the -USR1 restart
- # won't work for older versions).
- echo "Restarting root redirector as root."
- killall "$krName" &> /dev/null
- logdir="${XDG_CACHE_HOME:-$HOME/.cache}/keybase"
- mkdir -p "$logdir"
- log="$logdir/keybase.redirector.log"
- nohup "$krbin" "$rootmount" &>> "$log" &
- fi
- fi
- t=5
- while ! mountpoint "$rootmount" &> /dev/null; do
- sleep 1
- t=$((t-1))
- if [ $t -eq 0 ]; then
- echo "Redirector hasn't started yet."
- break
- fi
- done
- fi
- fi
- # Make the mountpoint if it doesn't already exist by this point.
- make_mountpoint "$is_redirector_enabled"
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.