aboutsummaryrefslogtreecommitdiff
path: root/store/debian-dev/setup/code-server.bash
blob: 1151dc249408940c12a7733702a0fa4b32a4824c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#! /usr/bin/env bash

set -e -o pipefail

if [[ $# != 1 ]]; then
    echo "Require exactly one argument, the password of the code server." >&2
    exit 1
fi

curl -fsSL https://code-server.dev/install.sh | sh

apt update && apt install argon2
mkdir -p "${HOME}/.config/code-server"
echo -e "auth: password\nhashed-password: " >> "${HOME}/.config/code-server/config.yaml"
echo -n "$1" | \
    argon2 "$(shuf -i 10000000-99999999 -n 1 --random-source /dev/urandom)" -e \
    >> "${HOME}/.config/code-server/config.yaml"