File clean-up

feature/font
AtelierSnek 2022-10-27 19:40:27 +11:00
parent db9b8b494f
commit 68dd97d94b
8 changed files with 5 additions and 1474 deletions

6
.gitignore vendored
View File

@ -13,4 +13,8 @@ hugo.linux
/.hugo_build.lock
#VS Code files
/.vscode
/.vscode
#Ignore Obsidian
/.obsidian
*/.obsidian

View File

@ -1,643 +0,0 @@
#!/bin/sh
# vim: noexpandtab:
# -----------------------------------------------------------------------------
# Forked from https://github.com/containerd/nerdctl/blob/48f189a53a24c12838433f5bb5dd57f536816a8a/extras/rootless/containerd-rootless-setuptool.sh
# Copyright Rin (Tamara Vassileva)
# Licensed under the Apache License, Version 2.0
# -----------------------------------------------------------------------------
# Copyright The containerd Authors.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------------
# Forked from https://github.com/moby/moby/blob/v20.10.3/contrib/dockerd-rootless-setuptool.sh
# Copyright The Moby Authors.
# Licensed under the Apache License, Version 2.0
# NOTICE: https://github.com/moby/moby/blob/v20.10.3/NOTICE
# -----------------------------------------------------------------------------
# containerd-rootless-setuptool.sh: setup tool for containerd-rootless.sh
# Needs to be executed as a non-root user.
#
# Typical usage: containerd-rootless-setuptool.sh install
set -eu
# utility functions
INFO() {
# https://github.com/koalaman/shellcheck/issues/1593
# shellcheck disable=SC2039
/bin/echo -e "\e[104m\e[97m[INFO]\e[49m\e[39m ${*}"
}
WARNING() {
# shellcheck disable=SC2039
/bin/echo >&2 -e "\e[101m\e[97m[WARNING]\e[49m\e[39m ${*}"
}
ERROR() {
# shellcheck disable=SC2039
/bin/echo >&2 -e "\e[101m\e[97m[ERROR]\e[49m\e[39m ${*}"
}
# constants
CONTAINERD_ROOTLESS_SH="containerd-rootless.sh"
SYSTEMD_CONTAINERD_UNIT="containerd.service"
SYSTEMD_BUILDKIT_UNIT="buildkit.service"
SYSTEMD_FUSE_OVERLAYFS_UNIT="containerd-fuse-overlayfs.service"
SYSTEMD_STARGZ_UNIT="stargz-snapshotter.service"
SYSTEMD_IPFS_UNIT="ipfs-daemon.service"
SYSTEMD_BYPASS4NETNSD_UNIT="bypass4netnsd.service"
# global vars
ARG0="$0"
REALPATH0="$(realpath "$ARG0")"
BIN=""
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
# run checks and also initialize global vars (BIN)
init() {
id="$(id -u)"
# User verification: deny running as root
if [ "$id" = "0" ]; then
ERROR "Refusing to install rootless containerd as the root user"
exit 1
fi
# set BIN
if ! BIN="$(command -v "$CONTAINERD_ROOTLESS_SH" 2>/dev/null)"; then
ERROR "$CONTAINERD_ROOTLESS_SH needs to be present under \$PATH"
exit 1
fi
BIN=$(dirname "$BIN")
# detect openrc
if ! rc-status >/dev/null 2>&1; then
ERROR "Needs OpenRC (rc-status)"
exit 1
fi
# HOME verification
if [ -z "${HOME:-}" ] || [ ! -d "$HOME" ]; then
ERROR "HOME needs to be set"
exit 1
fi
if [ ! -w "$HOME" ]; then
ERROR "HOME needs to be writable"
exit 1
fi
# Validate XDG_RUNTIME_DIR
if [ -z "${XDG_RUNTIME_DIR:-}" ] || [ ! -w "$XDG_RUNTIME_DIR" ]; then
ERROR "Aborting because but XDG_RUNTIME_DIR (\"$XDG_RUNTIME_DIR\") is not set, does not exist, or is not writable"
ERROR "Hint: this could happen if you changed users with 'su' or 'sudo'. To work around this:"
ERROR "- try again by first running with root privileges 'loginctl enable-linger <user>' where <user> is the unprivileged user and export XDG_RUNTIME_DIR to the value of RuntimePath as shown by 'loginctl show-user <user>'"
ERROR "- or simply log back in as the desired unprivileged user (ssh works for remote machines, machinectl shell works for local machines)"
ERROR "See also https://rootlesscontaine.rs/getting-started/common/login/ ."
exit 1
fi
}
# CLI subcommand: "check"
cmd_entrypoint_check() {
init
INFO "Checking RootlessKit functionality"
if ! rootlesskit \
--net=slirp4netns \
--disable-host-loopback \
--copy-up=/etc --copy-up=/run --copy-up=/var/lib \
true; then
ERROR "RootlessKit failed, see the error messages and https://rootlesscontaine.rs/getting-started/common/ ."
exit 1
fi
INFO "Checking cgroup v2"
controllers="/sys/fs/cgroup/cgroup.controllers"
if [ ! -f "${controllers}" ]; then
WARNING "Enabling cgroup v2 is highly recommended, see https://rootlesscontaine.rs/getting-started/common/cgroup2/ "
else
for f in cpu memory pids; do
if ! grep -qw "$f" "$controllers"; then
WARNING "The cgroup v2 controller \"$f\" is not delegated for the current user (\"$controllers\"), see https://rootlesscontaine.rs/getting-started/common/cgroup2/"
fi
done
fi
INFO "Checking overlayfs"
tmp=$(mktemp -d)
mkdir -p "${tmp}/l" "${tmp}/u" "${tmp}/w" "${tmp}/m"
if ! rootlesskit mount -t overlay -o lowerdir="${tmp}/l,upperdir=${tmp}/u,workdir=${tmp}/w" overlay "${tmp}/m"; then
WARNING "Overlayfs is not enabled, consider installing fuse-overlayfs snapshotter (\`$0 install-fuse-overlayfs\`), " \
"or see https://rootlesscontaine.rs/how-it-works/overlayfs/ to enable overlayfs."
fi
rm -rf "${tmp}"
INFO "Requirements are satisfied"
}
# CLI subcommand: "nsenter"
cmd_entrypoint_nsenter() {
# No need to call init()
pid=$(cat "$XDG_RUNTIME_DIR/containerd-rootless/child_pid")
exec nsenter --no-fork --wd="$(pwd)" --preserve-credentials -m -n -U -t "$pid" -- "$@"
}
#WIP: TODO fix this errror message
show_openrc_error() {
unit="$1"
n="20"
ERROR "Failed to start ${unit}. Run \`TODO SOMETHING GOES HERE\` to show the error log."
ERROR "Before retrying installation, you might need to uninstall the current setup: \`$0 uninstall -f ; ${BIN}/rootlesskit rm -rf ${HOME}/.local/share/containerd\`"
}
install_openrc_unit() {
unit="$1"
unit_file="${XDG_CONFIG_HOME}/openrc/user/${unit}"
if [ -f "${unit_file}" ]; then
WARNING "File already exists, skipping: ${unit_file}" #TODO Does this need changing?
else
INFO "Creating \"${unit_file}\""
mkdir -p "${XDG_CONFIG_HOME}/openrc/user"
cat >"${unit_file}"
systemctl --user daemon-reload #Is there a need for this on OpenRC? It should auto-read
fi
if ! systemctl --user --no-pager status "${unit}" >/dev/null 2>&1; then
INFO "Starting openrc unit \"${unit}\""
(
set -x
if ! rc-service start "${unit}"; then
set +x
show_openrc_error "${unit}"
exit 1
fi
sleep 3
)
fi
(
set -x
if ! systemctl --user --no-pager --full status "${unit}"; then
set +x
show_openrc_error "${unit}"
exit 1
fi
systemctl --user enable "${unit}"
)
INFO "Installed \"${unit}\" successfully."
INFO "To control \"${unit}\", run: \`rc-service ${unit} (start|stop|restart) \`"
}
uninstall_openrc_unit() {
unit="$1"
unit_file="${XDG_CONFIG_HOME}/openrc/user/${unit}"
if [ ! -f "${unit_file}" ]; then
INFO "Unit ${unit} is not installed"
return
fi
(
set -x
systemctl --user stop "${unit}"
) || :
(
set -x
systemctl --user disable "${unit}"
) || :
rm -f "${unit_file}"
INFO "Uninstalled \"${unit}\""
}
# CLI subcommand: "install"
cmd_entrypoint_install() {
init
cmd_entrypoint_check
cat <<-EOT | install_openrc_unit "${SYSTEMD_CONTAINERD_UNIT}"
[Unit]
Description=containerd (Rootless)
[Service]
Environment=PATH=$BIN:/sbin:/usr/sbin:$PATH
Environment=CONTAINERD_ROOTLESS_ROOTLESSKIT_FLAGS=${CONTAINERD_ROOTLESS_ROOTLESSKIT_FLAGS:-}
ExecStart=$BIN/${CONTAINERD_ROOTLESS_SH}
ExecReload=/bin/kill -s HUP \$MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
StartLimitBurst=3
StartLimitInterval=60s
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
Delegate=yes
Type=simple
KillMode=mixed
[Install]
WantedBy=default.target
EOT
systemctl --user daemon-reload
INFO "To run \"${SYSTEMD_CONTAINERD_UNIT}\" on system startup automatically, run: \`sudo loginctl enable-linger $(id -un)\`"
INFO "------------------------------------------------------------------------------------------"
INFO "Use \`nerdctl\` to connect to the rootless containerd."
INFO "You do NOT need to specify \$CONTAINERD_ADDRESS explicitly."
}
# CLI subcommand: "install-buildkit"
cmd_entrypoint_install_buildkit() {
init
if ! command -v "buildkitd" >/dev/null 2>&1; then
ERROR "buildkitd (https://github.com/moby/buildkit) needs to be present under \$PATH"
exit 1
fi
if ! systemctl --user --no-pager status "${SYSTEMD_CONTAINERD_UNIT}" >/dev/null 2>&1; then
ERROR "Install containerd first (\`$ARG0 install\`)"
exit 1
fi
cat <<-EOT | install_openrc_unit "${SYSTEMD_BUILDKIT_UNIT}"
[Unit]
Description=BuildKit (Rootless)
PartOf=${SYSTEMD_CONTAINERD_UNIT}
[Service]
Environment=PATH=$BIN:/sbin:/usr/sbin:$PATH
ExecStart="$REALPATH0" nsenter buildkitd
ExecReload=/bin/kill -s HUP \$MAINPID
RestartSec=2
Restart=always
Type=simple
KillMode=mixed
[Install]
WantedBy=default.target
EOT
}
# CLI subcommand: "install-buildkit-containerd"
cmd_entrypoint_install_buildkit_containerd() {
init
if ! command -v "buildkitd" >/dev/null 2>&1; then
ERROR "buildkitd (https://github.com/moby/buildkit) needs to be present under \$PATH"
exit 1
fi
if [ ! -f "${XDG_CONFIG_HOME}/buildkit/buildkitd.toml" ]; then
mkdir -p "${XDG_CONFIG_HOME}/buildkit"
cat <<-EOF > "${XDG_CONFIG_HOME}/buildkit/buildkitd.toml"
[worker.oci]
enabled = false
[worker.containerd]
enabled = true
rootless = true
EOF
fi
if ! systemctl --user --no-pager status "${SYSTEMD_CONTAINERD_UNIT}" >/dev/null 2>&1; then
ERROR "Install containerd first (\`$ARG0 install\`)"
exit 1
fi
UNIT_NAME=${SYSTEMD_BUILDKIT_UNIT}
BUILDKITD_FLAG=
if [ -n "${CONTAINERD_NAMESPACE:-}" ] ; then
UNIT_NAME="${CONTAINERD_NAMESPACE}-${SYSTEMD_BUILDKIT_UNIT}"
BUILDKITD_FLAG="${BUILDKITD_FLAG} --addr=unix://${XDG_RUNTIME_DIR}/buildkit-${CONTAINERD_NAMESPACE}/buildkitd.sock --root=${XDG_DATA_HOME}/buildkit-${CONTAINERD_NAMESPACE} --containerd-worker-namespace=${CONTAINERD_NAMESPACE}"
else
WARNING "buildkitd has access to images in \"buildkit\" namespace by default. If you want to give buildkitd access to the images in \"default\" namespace, run this command with CONTAINERD_NAMESPACE=default"
fi
if [ -n "${CONTAINERD_SNAPSHOTTER:-}" ] ; then
BULDKITD_FLAG="${BUILDKITD_FLAG} --containerd-worker-snapshotter=${CONTAINERD_SNAPSHOTTER}"
fi
cat <<-EOT | install_openrc_unit "${UNIT_NAME}"
[Unit]
Description=BuildKit (Rootless)
PartOf=${SYSTEMD_CONTAINERD_UNIT}
[Service]
Environment=PATH=$BIN:/sbin:/usr/sbin:$PATH
ExecStart="$REALPATH0" nsenter -- buildkitd ${BUILDKITD_FLAG}
ExecReload=/bin/kill -s HUP \$MAINPID
RestartSec=2
Restart=always
Type=simple
KillMode=mixed
[Install]
WantedBy=default.target
EOT
}
# CLI subcommand: "install-bypass4netnsd"
cmd_entrypoint_install_bypass4netnsd() {
init
if ! command -v "bypass4netnsd" >/dev/null 2>&1; then
ERROR "bypass4netnsd (https://github.com/rootless-containers/bypass4netns) needs to be present under \$PATH"
exit 1
fi
command_v_bypass4netnsd="$(command -v bypass4netnsd)"
# FIXME: bail if bypass4netnsd is an alias
cat <<-EOT | install_openrc_unit "${SYSTEMD_BYPASS4NETNSD_UNIT}"
[Unit]
Description=bypass4netnsd (daemon for bypass4netns, accelerator for rootless containers)
# Not PartOf=${SYSTEMD_CONTAINERD_UNIT}
[Service]
Environment=PATH=$BIN:/sbin:/usr/sbin:$PATH
ExecStart="${command_v_bypass4netnsd}"
ExecReload=/bin/kill -s HUP \$MAINPID
RestartSec=2
Restart=always
Type=simple
KillMode=mixed
[Install]
WantedBy=default.target
EOT
INFO "To use bypass4netnsd, set the \"nerdctl/bypass4netns=true\" label on containers, e.g., \`nerdctl run --label nerdctl/bypass4netns=true\`"
}
# CLI subcommand: "install-fuse-overlayfs"
cmd_entrypoint_install_fuse_overlayfs() {
init
if ! command -v "containerd-fuse-overlayfs-grpc" >/dev/null 2>&1; then
ERROR "containerd-fuse-overlayfs-grpc (https://github.com/containerd/fuse-overlayfs-snapshotter) needs to be present under \$PATH"
exit 1
fi
if ! command -v "fuse-overlayfs" >/dev/null 2>&1; then
ERROR "fuse-overlayfs (https://github.com/containers/fuse-overlayfs) needs to be present under \$PATH"
exit 1
fi
if ! systemctl --user --no-pager status "${SYSTEMD_CONTAINERD_UNIT}" >/dev/null 2>&1; then
ERROR "Install containerd first (\`$ARG0 install\`)"
exit 1
fi
cat <<-EOT | install_openrc_unit "${SYSTEMD_FUSE_OVERLAYFS_UNIT}"
[Unit]
Description=containerd-fuse-overlayfs (Rootless)
PartOf=${SYSTEMD_CONTAINERD_UNIT}
[Service]
Environment=PATH=$BIN:/sbin:/usr/sbin:$PATH
ExecStart="$REALPATH0" nsenter containerd-fuse-overlayfs-grpc "${XDG_RUNTIME_DIR}/containerd-fuse-overlayfs.sock" "${XDG_DATA_HOME}/containerd-fuse-overlayfs"
ExecReload=/bin/kill -s HUP \$MAINPID
RestartSec=2
Restart=always
Type=simple
KillMode=mixed
[Install]
WantedBy=default.target
EOT
INFO "Add the following lines to \"${XDG_CONFIG_HOME}/containerd/config.toml\" manually, and then run \`systemctl --user restart ${SYSTEMD_CONTAINERD_UNIT}\`:"
cat <<-EOT
### BEGIN ###
[proxy_plugins]
[proxy_plugins."fuse-overlayfs"]
type = "snapshot"
address = "${XDG_RUNTIME_DIR}/containerd-fuse-overlayfs.sock"
### END ###
EOT
INFO "Set \`export CONTAINERD_SNAPSHOTTER=\"fuse-overlayfs\"\` to use the fuse-overlayfs snapshotter."
}
# CLI subcommand: "install-stargz"
cmd_entrypoint_install_stargz() {
init
if ! command -v "containerd-stargz-grpc" >/dev/null 2>&1; then
ERROR "containerd-stargz-grpc (https://github.com/containerd/stargz-snapshotter) needs to be present under \$PATH"
exit 1
fi
if ! systemctl --user --no-pager status "${SYSTEMD_CONTAINERD_UNIT}" >/dev/null 2>&1; then
ERROR "Install containerd first (\`$ARG0 install\`)"
exit 1
fi
if [ ! -f "${XDG_CONFIG_HOME}/containerd-stargz-grpc/config.toml" ]; then
mkdir -p "${XDG_CONFIG_HOME}/containerd-stargz-grpc"
touch "${XDG_CONFIG_HOME}/containerd-stargz-grpc/config.toml"
fi
cat <<-EOT | install_openrc_unit "${SYSTEMD_STARGZ_UNIT}"
[Unit]
Description=stargz snapshotter (Rootless)
PartOf=${SYSTEMD_CONTAINERD_UNIT}
[Service]
Environment=PATH=$BIN:/sbin:/usr/sbin:$PATH
Environment=IPFS_PATH=${XDG_DATA_HOME}/ipfs
ExecStart="$REALPATH0" nsenter -- containerd-stargz-grpc -address "${XDG_RUNTIME_DIR}/containerd-stargz-grpc/containerd-stargz-grpc.sock" -root "${XDG_DATA_HOME}/containerd-stargz-grpc" -config "${XDG_CONFIG_HOME}/containerd-stargz-grpc/config.toml"
ExecReload=/bin/kill -s HUP \$MAINPID
RestartSec=2
Restart=always
Type=simple
KillMode=mixed
[Install]
WantedBy=default.target
EOT
INFO "Add the following lines to \"${XDG_CONFIG_HOME}/containerd/config.toml\" manually, and then run \`systemctl --user restart ${SYSTEMD_CONTAINERD_UNIT}\`:"
cat <<-EOT
### BEGIN ###
[proxy_plugins]
[proxy_plugins."stargz"]
type = "snapshot"
address = "${XDG_RUNTIME_DIR}/containerd-stargz-grpc/containerd-stargz-grpc.sock"
### END ###
EOT
INFO "Set \`export CONTAINERD_SNAPSHOTTER=\"stargz\"\` to use the stargz snapshotter."
}
# CLI subcommand: "install-ipfs"
cmd_entrypoint_install_ipfs() {
init
if ! command -v "ipfs" >/dev/null 2>&1; then
ERROR "ipfs needs to be present under \$PATH"
exit 1
fi
if ! systemctl --user --no-pager status "${SYSTEMD_CONTAINERD_UNIT}" >/dev/null 2>&1; then
ERROR "Install containerd first (\`$ARG0 install\`)"
exit 1
fi
IPFS_PATH="${XDG_DATA_HOME}/ipfs"
mkdir -p "${IPFS_PATH}"
cat <<-EOT | install_openrc_unit "${SYSTEMD_IPFS_UNIT}"
[Unit]
Description=ipfs daemon for rootless nerdctl
PartOf=${SYSTEMD_CONTAINERD_UNIT}
[Service]
Environment=PATH=$BIN:/sbin:/usr/sbin:$PATH
Environment=IPFS_PATH=${IPFS_PATH}
ExecStart="$REALPATH0" nsenter -- ipfs daemon $@
ExecReload=/bin/kill -s HUP \$MAINPID
RestartSec=2
Restart=always
Type=simple
KillMode=mixed
[Install]
WantedBy=default.target
EOT
# Avoid using 5001(api)/8080(gateway) which are reserved by tests.
# TODO: support unix socket
systemctl --user stop "${SYSTEMD_IPFS_UNIT}"
sleep 3
IPFS_PATH=${IPFS_PATH} ipfs config Addresses.API "/ip4/127.0.0.1/tcp/5888"
IPFS_PATH=${IPFS_PATH} ipfs config Addresses.Gateway "/ip4/127.0.0.1/tcp/5889"
systemctl --user restart "${SYSTEMD_IPFS_UNIT}"
sleep 3
INFO "If you use stargz-snapshotter, add the following line to \"${XDG_CONFIG_HOME}/containerd-stargz-grpc/config.toml\" manually, and then run \`systemctl --user restart ${SYSTEMD_STARGZ_UNIT}\`:"
cat <<-EOT
### BEGIN ###
ipfs = true
### END ###
EOT
INFO "If you want to expose the port 4001 of ipfs daemon, re-install rootless containerd with CONTAINERD_ROOTLESS_ROOTLESSKIT_FLAGS=\"--publish=0.0.0.0:4001:4001/tcp\" environment variable."
INFO "Set \`export IPFS_PATH=\"${IPFS_PATH}\"\` to use ipfs."
}
# CLI subcommand: "uninstall"
cmd_entrypoint_uninstall() {
init
uninstall_openrc_unit "${SYSTEMD_BUILDKIT_UNIT}"
uninstall_openrc_unit "${SYSTEMD_FUSE_OVERLAYFS_UNIT}"
uninstall_openrc_unit "${SYSTEMD_CONTAINERD_UNIT}"
INFO "This uninstallation tool does NOT remove containerd binaries and data."
INFO "To remove data, run: \`$BIN/rootlesskit rm -rf ${XDG_DATA_HOME}/containerd\`"
}
# CLI subcommand: "uninstall-buildkit"
cmd_entrypoint_uninstall_buildkit() {
init
uninstall_openrc_unit "${SYSTEMD_BUILDKIT_UNIT}"
INFO "This uninstallation tool does NOT remove data."
INFO "To remove data, run: \`$BIN/rootlesskit rm -rf ${XDG_DATA_HOME}/buildkit"
}
# CLI subcommand: "uninstall-buildkit-containerd"
cmd_entrypoint_uninstall_buildkit_containerd() {
init
UNIT_NAME=${SYSTEMD_BUILDKIT_UNIT}
BUILDKIT_ROOT="${XDG_DATA_HOME}/buildkit"
if [ -n "${CONTAINERD_NAMESPACE:-}" ] ; then
UNIT_NAME="${CONTAINERD_NAMESPACE}-${SYSTEMD_BUILDKIT_UNIT}"
BUILDKIT_ROOT="${XDG_DATA_HOME}/buildkit-${CONTAINERD_NAMESPACE}"
fi
uninstall_openrc_unit "${UNIT_NAME}"
INFO "This uninstallation tool does NOT remove data."
INFO "To remove data, run: \`$BIN/rootlesskit rm -rf ${BUILDKIT_ROOT}\`"
}
# CLI subcommand: "uninstall-bypass4netnsd"
cmd_entrypoint_uninstall_bypass4netnsd() {
init
uninstall_openrc_unit "${SYSTEMD_BYPASS4NETNSD_UNIT}"
}
# CLI subcommand: "uninstall-fuse-overlayfs"
cmd_entrypoint_uninstall_fuse_overlayfs() {
init
uninstall_openrc_unit "${SYSTEMD_FUSE_OVERLAYFS_UNIT}"
INFO "This uninstallation tool does NOT remove data."
INFO "To remove data, run: \`$BIN/rootlesskit rm -rf ${XDG_DATA_HOME}/containerd-fuse-overlayfs"
}
# CLI subcommand: "uninstall-stargz"
cmd_entrypoint_uninstall_stargz() {
init
uninstall_openrc_unit "${SYSTEMD_STARGZ_UNIT}"
INFO "This uninstallation tool does NOT remove data."
INFO "To remove data, run: \`$BIN/rootlesskit rm -rf ${XDG_DATA_HOME}/containerd-stargz-grpc"
}
# CLI subcommand: "uninstall-ipfs"
cmd_entrypoint_uninstall_ipfs() {
init
uninstall_openrc_unit "${SYSTEMD_IPFS_UNIT}"
INFO "This uninstallation tool does NOT remove data."
INFO "To remove data, run: \`$BIN/rootlesskit rm -rf ${XDG_DATA_HOME}/ipfs"
}
# text for --help
usage() {
echo "Usage: ${ARG0} [OPTIONS] COMMAND"
echo
echo "A setup tool for Rootless containerd (${CONTAINERD_ROOTLESS_SH})."
echo
echo "Commands:"
echo " check Check prerequisites"
echo " nsenter Enter into RootlessKit namespaces (mostly for debugging)"
echo " install Install openrc unit and show how to manage the service"
echo " uninstall Uninstall openrc unit"
echo
echo "Add-on commands (BuildKit):"
echo " install-buildkit Install the openrc unit for BuildKit"
echo " uninstall-buildkit Uninstall the openrc unit for BuildKit"
echo
echo "Add-on commands (bypass4netnsd):"
echo " install-bypass4netnsd Install the openrc unit for bypass4netnsd"
echo " uninstall-bypass4netnsd Uninstall the openrc unit for bypass4netnsd"
echo
echo "Add-on commands (fuse-overlayfs):"
echo " install-fuse-overlayfs Install the openrc unit for fuse-overlayfs snapshotter"
echo " uninstall-fuse-overlayfs Uninstall the openrc unit for fuse-overlayfs snapshotter"
echo
echo "Add-on commands (stargz):"
echo " install-stargz Install the openrc unit for stargz snapshotter"
echo " uninstall-stargz Uninstall the openrc unit for stargz snapshotter"
echo
echo "Add-on commands (ipfs):"
echo " install-ipfs [ipfs-daemon-flags...] Install the openrc unit for ipfs daemon. Specify \"--offline\" if run the daemon in offline mode"
echo " uninstall-ipfs Uninstall the openrc unit for ipfs daemon"
echo
echo "Add-on commands (BuildKit containerd worker):"
echo " install-buildkit-containerd Install the openrc unit for BuildKit with CONTAINERD_NAMESPACE=${CONTAINERD_NAMESPACE:-} and CONTAINERD_SNAPSHOTTER=${CONTAINERD_SNAPSHOTTER:-}"
echo " uninstall-buildkit-containerd Uninstall the openrc unit for BuildKit with CONTAINERD_NAMESPACE=${CONTAINERD_NAMESPACE:-} and CONTAINERD_SNAPSHOTTER=${CONTAINERD_SNAPSHOTTER:-}"
}
# parse CLI args
if ! args="$(getopt -o h --long help -n "$ARG0" -- "$@")"; then
usage
exit 1
fi
eval set -- "$args"
while [ "$#" -gt 0 ]; do
arg="$1"
shift
case "$arg" in
-h | --help)
usage
exit 0
;;
--)
break
;;
*)
# XXX this means we missed something in our "getopt" arguments above!
ERROR "Scripting error, unknown argument '$arg' when parsing script arguments."
exit 1
;;
esac
done
command=$(echo "${1:-}" | sed -e "s/-/_/g")
if [ -z "$command" ]; then
ERROR "No command was specified. Run with --help to see the usage. Maybe you want to run \`$ARG0 install\`?"
exit 1
fi
if ! command -v "cmd_entrypoint_${command}" >/dev/null 2>&1; then
ERROR "Unknown command: ${command}. Run with --help to see the usage."
exit 1
fi
# main
shift
"cmd_entrypoint_${command}" "$@"

View File

@ -1,3 +0,0 @@
{
"vimMode": true
}

View File

@ -1,3 +0,0 @@
{
"cssTheme": "Everforest"
}

View File

@ -1,19 +0,0 @@
[
"file-explorer",
"global-search",
"switcher",
"graph",
"backlink",
"outgoing-link",
"tag-pane",
"page-preview",
"daily-notes",
"templates",
"note-composer",
"command-palette",
"editor-status",
"starred",
"outline",
"word-count",
"file-recovery"
]

View File

@ -1 +0,0 @@
{}

View File

@ -1,669 +0,0 @@
/***** TABLE OF CONTENTS *****/
/* TODO: Reformat entire CSS file as below.
/* 1. Font
/* 2. Colours
/* 2.1. Dark theme color variables
/* 2.2. Light theme color variables
/* 2.3. Dark theme implementation
/* 2.4. Light theme implementation
/* 3. General UI
/* 3.1. Title Bar
/* 4. Markdown (editor / preview)
/* 4.1. Headings
/* 4.1.1. Fix font weights
/* 4.2. Links
/* 4.2.1. Nifty arrow before internal links (also applies to embeds)
/* 4.3. Embeds
/* 4.4. Tables
/* 4.5. Popovers
/* 4.6. Task Lists
/* 4.7. Blockquotes
/* 4.8. Code
/* 4.9. Bulleted lists
/* 4.10. Misc Fixes
/* 5. Graph view colours
/* 6. Notion Colour Blocks
/* 7. In-document header (scrolls with the document) [remove for compatibility with Andy's mode]
/* 7.1. Adjustments for non-in-document headers (graphs, etc)\
/* 7.2. Active pane border
/* 7.3. Misc fixes
/* 8. Tags
/* 8.1. Tag custom colours
/***** *****/
/* 1. Font */
body {
/* font stacks taken directly from Notion */
--font-monospace: "Hack Nerd Font", "Source Code Pro", monospace;
-webkit-font-smoothing: auto;
}
/* 2. Colours */
:root
{
/* 2.1 Dark theme color variables */
--bg0-dark: #22282c;
--bg1-dark: #272f34;
--bg-dark: #2f383e;
--bg2-dark: #374247;
--bg3-dark: #404c51;
--bg4-dark: #4a555b;
--bg5-dark: #525c62;
--bg_visual: #503946;
--bg_red: #4e3e43;
--bg_green: #404d44;
--bg_blue: #394f5a;
--bg_yellow: #4a4940;
--shadow: #00000070;
--fg-dark: #d3c6aa;
--grey0-dark: #7f897d;
--grey1-dark: #859289;
--grey2-dark: #9aa79d;
--faded-red: #e67e80;
--faded-orange: #e69875;
--faded-yellow: #dbbc7f;
--faded-green: #a7c080;
--faded-aqua: #83c092;
--faded-blue: #7fbbb3;
--faded-purple: #d699b6;
--dim-red: #da6362;
--dim-orange: #d77f48;
--dim-yellow: #bf983d;
--dim-green: #899c40;
--dim-aqua: #569d79;
--dim-blue: #5a93a2;
--dim-purple: #b87b9d;
/* 2.2 Light theme color variables */
--bg0-light: #f0edd8;
--bg1-light: #f6f1dd;
--bg-light: #fdf6e3;
--bg2-light: #f3efda;
--bg3-light: #edead5;
--bg4-light: #e4e1cd;
--bg5-light: #dfdbc8;
--grey0-light: #a4ad9e;
--grey1-light: #939f91;
--grey2-light: #879686;
--shadow-light: #3c474d20;
--bg_visual_light: #eaedc8;
--bg_red_light: #fbe3da;
--bg_green_light: #f0f1d2;
--bg_blue_light: #e9f0e9;
--bg_yellow_light: #faedcd;
--fg-light: #5c6a72;
--light-red: #f85552;
--light-orange: #f57d26;
--light-yellow: #bf983d;
--light-green: #899c40;
--light-aqua: #569d79;
--light-blue: #5a93a2;
--light-purple: #b87b9d;
--light-dim-red: #f1706f;
--light-dim-orange: #f39459;
--light-dim-yellow: #e4b649;
--light-dim-green: #a4bb4a;
--light-dim-aqua: #6ec398;
--light-dim-blue: #6cb3c6;
--light-dim-purple: #e092be;
}
/* 2.3 Dark theme implementation */
.theme-dark
{
--background-primary: var(--bg-dark);
--background-primary-alt: var(--bg-dark);
--background-secondary: var(--bg-dark);
--background-secondary-alt: var(--bg-dark);
--text-normal: var(--fg-dark);
--text-faint: var(--grey1-dark);
--text-title-h1: var(--dim-red);
--text-title-h2: var(--dim-orange);
--text-title-h3: var(--dim-yellow);
--text-title-h4: var(--dim-green);
--text-title-h5: var(--dim-aqua);
--text-title-h6: var(--dim-purple);
--text-link: var(--faded-blue);
--text-a: var(--dim-aqua);
--text-a-hover: var(--faded-aqua);
--text-mark: rgba(215, 153, 33, 0.4); /* light-yellow */
--pre-code: var(--bg1-dark);
--text-highlight-bg: var(--bg_green);
--interactive-accent: var(--dim-aqua);
--interactive-before: var(--bg5-dark);
--background-modifier-border: var(--bg5-dark);
--text-accent: var(--dim-blue);
--interactive-accent-rgb: var(--dim-blue);
--inline-code: var(--dim-blue);
--code-block: var(--fg-dark);
--vim-cursor: var(--faded-blue);
--text-selection: var(--bg5-dark);
}
/* 2.4 Light theme implementation */
.theme-light
{
--background-primary: var(--bg-light);
--background-primary-alt: var(--bg-light);
--background-secondary: var(--bg-light);
--background-secondary-alt: var(--bg-light);
--text-normal: var(--fg-light);
--text-faint: var(--grey1-light);
--text-title-h1: var(--light-red);
--text-title-h2: var(--light-orange);
--text-title-h3: var(--light-yellow);
--text-title-h4: var(--light-green);
--text-title-h5: var(--light-aqua);
--text-title-h6: var(--light-purple);
--text-link: var(--light-blue);
--text-a: var(--light-dim-blue);
--text-a-hover: var(--light-blue);
--text-mark: rgba(215, 153, 33, 0.4); /* light-yellow */
--pre-code: var(--bg1-light);
--text-highlight-bg: var(--light-dim-green);
--interactive-accent: var(--bg5-light);
--interactive-before: var(--bg5-light);
--background-modifier-border: var(--bg5-light);
--text-accent: var(--bg5-light);
--interactive-accent-rgb: var(--light-dim-green);
--inline-code: var(--light-blue);
--code-block: var(--fg-light);
--vim-cursor: var(--light-blue);
--text-selection: rgba(189, 174, 147, 0.5); /* light3 */
}
.theme-dark code[class*="language-"],
.theme-dark pre[class*="language-"],
.theme-light code[class*="language-"],
.theme-light pre[class*="language-"]
{
text-shadow: none ;
background-color: var(--pre-code) ;
}
/* 3. General UI */
.view-header-title {
font-weight: 700;
}
/* 3.1. Title bar */
.titlebar {
background-color: var(--background-secondary-alt);
}
.titlebar-inner {
color: var(--text-normal);
}
.graph-view.color-circle,
.graph-view.color-fill-highlight,
.graph-view.color-line-highlight
{
color: var(--interactive-accent-rgb) ;
}
.graph-view.color-text
{
color: var(--text-a-hover) ;
}
/*
.graph-view.color-fill
{
color: var(--background-secondary);
}
.graph-view.color-line
{
color: var(--background-modifier-border);
}
*/
html,
body
{
font-size: 16px ;
}
strong
{
font-weight: 600 ;
}
a,
.cm-hmd-internal-link
{
color: var(--text-a) ;
text-decoration: none ;
}
a:hover,
.cm-hmd-internal-link:hover,
.cm-url
{
color: var(--text-a-hover) ;
text-decoration: none ;
}
/*----------------------------------------------------------------
TAGS
----------------------------------------------------------------*/
.token.tag {
padding: 0px 0px;
background-color: transparent;
border: none;
}
.token.tag:hover {
background: transparent;
color: var(--text-a-hover) !important;
}
/*----------------------------------------------------------------
TAG PILLS
----------------------------------------------------------------*/
.markdown-preview-section h1 a.tag,
.markdown-preview-section h2 a.tag,
.markdown-preview-section h3 a.tag,
.markdown-preview-section h4 a.tag,
.markdown-preview-section h5 a.tag,
.markdown-preview-section h4 a.tag {
font-weight: inherit;
}
.tag {
background-color: var(--tag-base);
border: 1px solid var(--interactive-accent);
color: var(--text-a);
font-weight: 500;
padding: 1.5px 6px;
padding-left: 6px;
padding-right: 6px;
text-align: center;
text-decoration: none !important;
display: inline-block;
cursor: pointer;
border-radius: 8px;
transition: 0.2s ease-in-out;
}
.tag:hover {
color: var(--interactive-accent);
}
/*----------------------------------------------------------------
TAG REF STYLING
----------------------------------------------------------------*/
.tag[href^="#❗️"],
.tag[href^="#important❗"] {
background-color: var(--tag-base);
border: 1px solid var(--boldred);
}
.tag[href^="#📓"],
.tag[href^="#journal📓"] {
background-color: var(--tag-base);
border: 1px solid var(--purple);
}
.tag[href^="#🌱"],
.tag[href^="#seedling🌱"],
.tag[href^="#🌿"],
.tag[href^="#budding🌿"],
.tag[href^="#🌳"],
.tag[href^="#evergreen🌳"] {
background-color: var(--tag-base);
border: 1px solid var(--boldgreen);
}
mark
{
background-color: var(--text-mark) ;
}
.view-actions a
{
color: var(--text-normal) ;
}
.view-actions a:hover
{
color: var(--text-a) ;
}
.HyperMD-codeblock-bg
{
background-color: var(--pre-code) ;
}
.HyperMD-codeblock
{
line-height: 1.4em ;
color: var(--code-block) ;
}
.HyperMD-codeblock-begin
{
border-top-left-radius: 4px ;
border-top-right-radius: 4px ;
}
.HyperMD-codeblock-end
{
border-bottom-left-radius: 4px ;
border-bottom-right-radius: 4px ;
}
th
{
font-weight: 600 ;
}
thead
{
border-bottom: 2px solid var(--background-modifier-border) ;
}
.HyperMD-table-row
{
line-height: normal ;
padding-left: 4px ;
padding-right: 4px ;
/* background-color: var(--pre-code) ; */
}
.HyperMD-table-row-0
{
padding-top: 4px ;
}
.CodeMirror-foldgutter-folded,
.is-collapsed .nav-folder-collapse-indicator
{
color: var(--text-a) ;
}
.nav-file-tag
{
color: var(--text-a) ;
}
.is-active .nav-file-title
{
color: var(--text-a) ;
background-color: var(--background-primary-alt) ;
}
.nav-file-title
{
border-bottom-left-radius: 0 ;
border-bottom-right-radius: 0 ;
border-top-left-radius: 0 ;
border-top-right-radius: 0 ;
}
img
{
display: block ;
margin-left: auto ;
margin-right: auto ;
}
.HyperMD-list-line
{
padding-top: 0 ;
}
.CodeMirror-code,
.CodeMirror-linenumber,
.cm-formatting
{
font-family: var(--font-monospace) ;
font-size: 0.9em;
}
.markdown-preview-section pre code,
.markdown-preview-section code
{
font-size: 0.9em ;
background-color: var(--pre-code) ;
}
.markdown-preview-section pre code
{
padding: 4px ;
line-height: 1.4em ;
display: block ;
color: var(--code-block) ;
}
.markdown-preview-section code
{
color: var(--inline-code) ;
}
.cm-s-obsidian,
.cm-inline-code
{
-webkit-font-smoothing: auto ;
}
.cm-inline-code
{
color: var(--inline-code) ;
background-color: var(--pre-code) ;
padding: 1px ;
}
.workspace-leaf-header-title
{
font-weight: 600 ;
}
.side-dock-title
{
padding-top: 15px ;
font-size: 20px ;
}
.side-dock-ribbon-tab:hover,
.side-dock-ribbon-action:hover,
.side-dock-ribbon-action.is-active:hover,
.nav-action-button:hover,
.side-dock-collapse-btn:hover
{
color: var(--text-a);
}
.side-dock
{
border-right: 0 ;
}
.cm-s-obsidian,
.markdown-preview-view
{
/* padding-left: 10px ; */
padding-right: 10px ;
}
/* vertical resize-handle */
.workspace-split.mod-vertical > * > .workspace-leaf-resize-handle,
.workspace-split.mod-left-split > .workspace-leaf-resize-handle,
.workspace-split.mod-right-split > .workspace-leaf-resize-handle
{
width: 1px ;
background-color: var(--dim-aqua);
}
/* horizontal resize-handle */
.workspace-split.mod-horizontal > * > .workspace-leaf-resize-handle
{
height: 1px ;
background-color: var(--dim-aqua);
}
/* Remove vertical split padding */
.workspace-split.mod-root .workspace-split.mod-vertical .workspace-leaf-content,
.workspace-split.mod-vertical > .workspace-split,
.workspace-split.mod-vertical > .workspace-leaf,
.workspace-tabs
{
padding-right: 0px;
}
.markdown-embed-title
{
font-weight: 600 ;
}
.markdown-embed
{
padding-left: 10px ;
padding-right: 10px ;
margin-left: 10px ;
margin-right: 10px ;
}
.cm-header-1,
.markdown-preview-section h1
{
font-weight: 500 ;
font-size: 34px ;
color: var(--text-title-h1) ;
}
.cm-header-2,
.markdown-preview-section h2
{
font-weight: 500 ;
font-size: 26px ;
color: var(--text-title-h2) ;
}
.cm-header-3,
.markdown-preview-section h3
{
font-weight: 500 ;
font-size: 22px ;
color: var(--text-title-h3) ;
}
.cm-header-4,
.markdown-preview-section h4
{
font-weight: 500 ;
font-size: 20px ;
color: var(--text-title-h4) ;
}
.cm-header-5,
.markdown-preview-section h5
{
font-weight: 500 ;
font-size: 18px ;
color: var(--text-title-h5) ;
}
.cm-header-6,
.markdown-preview-section h6
{
font-weight: 500 ;
font-size: 18px ;
color: var(--text-title-h6) ;
}
.suggestion-item.is-selected
{
background-color: var(--text-selection);
}
.empty-state-container:hover
{
background-color: var(--background-secondary-alt);
border: 5px solid var(--interactive-accent) ;
}
.checkbox-container
{
background-color: var(--interactive-before);
}
.checkbox-container:after
{
background-color: var(--interactive-accent);
}
.checkbox-container.is-enabled:after
{
background-color: var(--bg5-dark);
}
.mod-cta
{
color: var(--background-secondary-alt) ;
font-weight: 600 ;
}
.mod-cta a
{
color: var(--background-secondary-alt) ;
font-weight: 600 ;
}
.mod-cta:hover
{
background-color: var(--interactive-before) ;
font-weight: 600 ;
}
.CodeMirror-cursor
{
background-color: var(--vim-cursor) ;
opacity: 60% ;
}
input.task-list-item-checkbox {
border: 1px solid var(--faded-blue);
appearance: none;
-webkit-appearance: none;
}
input.task-list-item-checkbox:checked
{
background-color: var(--faded-blue);
box-shadow: inset 0 0 0 2px var(--background-primary);
}
::selection
{
background-color: var(--text-selection) ;
}
.mermaid .note
{
fill: var(--dark3) ;
}
.frontmatter-container {
display: none;
}
/* Bullet point relationship lines */
.markdown-source-view.mod-cm6 .cm-indent::before,
.markdown-rendered.show-indentation-guide li > ul::before,
.markdown-rendered.show-indentation-guide li > ol::before {
position: absolute;
border-right: 1px solid var(--dim-blue);
}

View File

@ -1,135 +0,0 @@
{
"main": {
"id": "0dcf92fb98d9c2b7",
"type": "split",
"children": [
{
"id": "d2010cb2ed47df72",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "rootless-containers-alpine.md",
"mode": "source",
"source": true
}
}
}
],
"direction": "vertical"
},
"left": {
"id": "087c4815ba51a7aa",
"type": "split",
"children": [
{
"id": "a7608751ba799cd4",
"type": "tabs",
"children": [
{
"id": "fcd11343af776433",
"type": "leaf",
"state": {
"type": "file-explorer",
"state": {}
}
},
{
"id": "131c386952c6d285",
"type": "leaf",
"state": {
"type": "search",
"state": {
"query": "",
"matchingCase": false,
"explainSearch": false,
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical"
}
}
},
{
"id": "970a5b0b94f320f4",
"type": "leaf",
"state": {
"type": "starred",
"state": {}
}
}
]
}
],
"direction": "horizontal",
"width": 300
},
"right": {
"id": "57d7bb53099a1925",
"type": "split",
"children": [
{
"id": "e74e1359728d8c4d",
"type": "tabs",
"children": [
{
"id": "e404835578910261",
"type": "leaf",
"state": {
"type": "backlink",
"state": {
"file": "rootless-containers-alpine.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
"showSearch": false,
"searchQuery": "",
"backlinkCollapsed": false,
"unlinkedCollapsed": true
}
}
},
{
"id": "a0252ac6a440959c",
"type": "leaf",
"state": {
"type": "outgoing-link",
"state": {
"file": "rootless-containers-alpine.md",
"linksCollapsed": false,
"unlinkedCollapsed": true
}
}
},
{
"id": "4b19ecb63868cdbc",
"type": "leaf",
"state": {
"type": "tag",
"state": {
"sortOrder": "frequency",
"useHierarchy": true
}
}
},
{
"id": "05dc04e4a372898e",
"type": "leaf",
"state": {
"type": "outline",
"state": {
"file": "rootless-containers-alpine.md"
}
}
}
]
}
],
"direction": "horizontal",
"width": 300,
"collapsed": true
},
"active": "d2010cb2ed47df72",
"lastOpenFiles": [
"rootless-containers-alpine.md"
]
}