bsky-sh-cli

About installation

This document explains how to install and update after installation.

How To Install

Run download installer

Overview

By downloading and running one file in the GitHub repository, the following installation-related processes will be performed.

  1. Download the latest release archive to a temporary directory
  2. Extract the downloaded release archive in a temporary directory
  3. Run the installer (install.sh) in the release archive
  4. Delete temporary directory

How to run

For super user:

sudo -s sh download-install.sh

For general users:

sh download-install.sh

[!WARNING] Direct execution like below is not recommended.

curl https://raw.githubusercontent.com/bills-appworks/bsky-sh-cli/main/download-install.sh | sh

Input waiting within the installer is disabled. As a result, the installation method cannot be selected, and the final confirmation waiting process loops endlessly, making installation impossible.

sudo sh <(https://raw.githubusercontent.com/bills-appworks/bsky-sh-cli/main/download-install.sh)

If you run the downloaded file as a super user using standard input, execution may fail depending on the environment for security reasons.

Run installer in release archive

Overview

You can install this tool in your environment by running the simple installer: install.sh included in the latest release archive.

The following describes what to do. If it does not meet your needs, please refer to Manual installation.

If necessary, you will be asked to confirm execution or input during installation (confirmation or input may not be required depending on the install.sh command option specification).

If you create or modify (add) a login script that sets the environment variable PATH during the installation process, the environment variable PATH will not be set immediately after the installation is completed. To execute the bsky command without specifying a path, log in to the shell again.

How to run

For super user:

sudo -s ./install.sh

For general users:

./install.sh

What install.sh does

  1. Check the existence of some files under the subdirectories bin and lib. It is assumed that the directory and file structure is the same as provided.
  2. Check the existence of the commands required when running this tool. If it does not exist, please install the necessary tools in advance. The following commands are checked (subject to change depending on version):
    • Required
      • curl
      • jq
      • sed : Requires GNU sed. Check for errors when specifying the -z option. For Mac, please install it with brew install gnu-sed etc.
    • Recommendation
      • convert (imagemagick): If it does not exist, display a warning that some image posting and link card functions cannot be used and continue the installation.
      • file (libmagic): If it does not exist, display a warning that image posting and link cards cannot be used and continue the installation.
  3. Copy the subdirectories bin and lib and the files under them to the specified installation directory.
    • The copy destination installation directory is specified in Startup options, or if not specified, the following is suggested: If the proposal is not what you want, you can change it.
      • The installation execution user is a super user (when executed with sudo or root):
        • /opt/bsky_sh_cli
      • If the installation execution user is a general user:
        • $HOME/.local/bsky_sh_cli
  4. Check the setting status of the environment variable PATH to the bin subdirectory under the installation directory, and if it is not set, we will suggest creating or modifying (adding) a login script. If the proposal is not what you want, you can change it.
    • The installation execution user is a super user (when executed with sudo or root):
      • If $SHELL is /bin/zsh
        • /etc/zprofile
      • If $SHELL is not /bin/zsh
        • /etc/profile.d/bsky_sh_cli.sh
    • If the installation execution user is a general user:
      • If $SHELL is /bin/bash
        • Files found by checking the following sequentially
          1. $HOME/.bashrc
          2. $HOME/.bash_profile
          3. $HOME/.bash_login
      • If $SHELL is /bin/zsh
        • Files found by checking the following sequentially
          1. $HOME/.zshrc
          2. $HOME/.zlogin
      • If the the file is not found above:
        • If $SHELL is /bin/zsh
          • $HOME/.zprofile
        • If $SHELL is not /bin/zsh
          • $HOME/.profile
    • Add the following line (create the file if it doesn’t exist):
      PATH=$PATH:<specified installation directory>/bin
      export PATH
      
  5. Suggests the installation of a Run Commands file that provides customization settings for this tool. You can skip it if you don’t need it.
    • The installation location of the Run Commands file is as follows.
      • $HOME/.bsky_sh_cli_rc
    • If a file with the same name already exists, you will be asked to confirm whether to skip it. Please note that if you overwrite without skipping, the existing settings will be erased.
      • If you want to keep the existing settings and check the settings file in the new version, please refer to the provided file .bsky_sh_cli_rc.sample without overwriting it.
  6. The contents specified above will be displayed in a list and you will be asked to confirm execution. If there is no problem with the content, please continue.
  7. Executes the specified processing.

install.sh command options

You can change the behavior by specifying the following options when running install.sh.

Manual installation

If this installer does not cover your preferred installation method (or you do not trust it), you can install by manually locating directories and files.

Please copy the following directories and files included in the provided files to the corresponding location.

To run the bsky command without specifying a path, edit the login script according to your environment and add the full path of the bin directory to the environment variable PATH.

Self hosted AT server (PDS)

If you are self-hosting the AT server (PDS), you can easily point the program at your server through the use of an exported environment variable.

If you are self-hosting the AT server (PDS), then add this line, replacing sky.example.com with the url to your AT server, to either your .profile or .bashrc as applicable:

export BSKYSHCLI_SELFHOSTED_DOMAIN=sky.example.com

The script will then query your AT server (PDS) instead of bsky.social.

How To Update

Execute update command

If it has already been installed, you can update the tool itself to the latest version using the installed bsky command (bsky update).

If you installed as a super user:

sudo -i bsky update

If you installed as a general user:

bsky update

See the command line reference for details.