Skip to content

Latest commit

 

History

History
141 lines (128 loc) · 5.78 KB

README.org

File metadata and controls

141 lines (128 loc) · 5.78 KB

index.html

(if (file-exists-p "./README.html") (with-temp-buffer (insert-file-contents "./README.html") (buffer-string)) "")

This was adapted from ellipsis.sh, raw file here:

<<\EOF # This is also a bootstrapping script! Check out <a href="https://bootstrap.syvl.org">the <code>bootstrap</code> program</a> and <a href="https://index.syvl.org">the shell script</a> for more information.
<<4751ce0e-6018-4f00-8c6d-89f43c3fb792()>><!-- This is where the site html goes.
EOF
# This is where the site html ends.

index.sh

For information on how to prompt when piping to sh, see Graeme’s answer here, and ferhtgoldaraz’s answer here.

set -eo pipefail
mkdir -p "$HOME/.local/share/syvl"
bootstrap="$HOME/.local/share/syvl/bootstrap"
flake="$HOME/.local/share/syvl/flake.nix"
default="$HOME/.local/share/syvl/default.nix"
lockfile="$HOME/.local/share/syvl/flake.lock"

Adapted from Graeme’s answer here, and ferhtgoldaraz’s answer here:

if [ -f "$bootstrap" ]; then
    read -p $'Curl hylang bootstrap script: ' curlIndexScript < /dev/tty
else
    curlIndexScript="yes"
fi
if [ "$curlIndexScript" == "y" ] || [ "$curlIndexScript" == "yes" ]; then
    curl -fsSLo $bootstrap https://raw.githubusercontent.com/sylvorg/sylvorg.github.io/main/index.hy
fi
if [ -f "$flake" ]; then
    read -p $'Curl nix flake: ' curlNixFlake < /dev/tty
else
    curlNixFlake="yes"
fi
if [ "$curlNixFlake" == "y" ] || [ "$curlNixFlake" == "yes" ]; then
    curl -fsSLo $flake https://raw.githubusercontent.com/sylvorg/sylvorg.github.io/main/flake.nix
fi
if [ -f "$lockfile" ]; then
    read -p $'Curl nix flake lockfile: ' curlNixLockfile < /dev/tty
else
    curlNixLockfile="yes"
fi
if [ "$curlNixLockfile" == "y" ] || [ "$curlNixLockfile" == "yes" ]; then
    curl -fsSLo $lockfile https://raw.githubusercontent.com/sylvorg/sylvorg.github.io/main/flake.lock
fi
if [ -f "$default" ]; then
    read -p $'Curl flake-compat default.nix: ' curlNixDefault < /dev/tty
else
    curlNixDefault="yes"
fi
if [ "$curlNixDefault" == "y" ] || [ "$curlNixDefault" == "yes" ]; then
    curl -fsSLo $default https://raw.githubusercontent.com/sylvorg/sylvorg.github.io/main/default.nix
fi
chmod +x $bootstrap
if hash nix 2> /dev/null; then
    $bootstrap $@
else
    read -p $'Install nix: ' installNix < /dev/tty
    if [ "$installNix" == "y" ] || [ "$installNix" == "yes" ]; then
        read -p $'Install nix as multi-user: ' installMulti < /dev/tty
        if [ "$installMulti" == "y" ] || [ "$installMulti" == "yes" ]; then
            sh <(curl -fsSL https://nixos.org/nix/install) --daemon
        else
            sh <(curl -fsSL https://nixos.org/nix/install) --no-daemon
        fi
    fi
    set +eo pipefail
    if ! $bootstrap $@; then
        set -eo pipefail
        if [ "$(uname -o)" == "Android" ]; then
            termux-setup-storage
        fi
        read -p $'Nix-shell bootstrap failed; try again after installing dependencies: ' installDeps < /dev/tty
        if [ "$installDeps" == "y" ] || [ "$installDeps" == "yes" ]; then
            pacapt="$HOME/.local/share/syvl/pacapt"
            if [ -f "$pacapt" ]; then
                read -p $'Curl pacapt: ' curlPacapt < /dev/tty
            else
                curlPacapt="yes"
            fi
            if [ "$curlPacapt" == "y" ] || [ "$curlPacapt" == "yes" ]; then
                if [ "$(uname -o)" == "Android" ]; then
                    pkg install curl
                    ln -s /data/data/com.termux/files/usr/lib/libssl.so /data/data/com.termux/files/usr/lib/libssl.so.1.1 || :
                    ln -s /data/data/com.termux/files/usr/lib/libcrypto.so /data/data/com.termux/files/usr/lib/libcrypto.so.1.1 || :
                    apt update
                    apt upgrade
                fi
                curl -fsSLo $pacapt https://raw.githubusercontent.com/icy/pacapt/ng/pacapt
            fi
            read -p $'Install dependencies: ' setupDependencies < /dev/tty
            if [ "$setupDependencies" == "y" ] || [ "$setupDependencies" == "yes" ]; then
                chmod +x $pacapt
                $pacapt -Syyu yadm git fd emacs gnupg git-crypt pass python assh
                pip install --force-reinstall --upgrade https://github.com/syvlorg/bakery/archive/main.tar.gz \
                                                        https://github.com/syvlorg/tailapi/archive/main.tar.gz \
                                                        requests
                if [ "$(uname -o)" == "Android" ]; then
                    ln -sf $(which sh) $(dirname $(which sh))/nix-shell
                else
                    $pacapt -Syyu tailscale
                fi
            fi
            hy $bootstrap $@
        fi
    fi
fi