Compare commits

...

7 commits

Author SHA1 Message Date
a21a21be9a
keydir 2024-03-25 15:47:24 +01:00
0b55a80d97
cd 2024-03-25 15:42:26 +01:00
e40ae2dba2
tmp/fix 2024-03-25 15:36:24 +01:00
6cde243005
clear known_hosts 2024-03-25 12:53:37 +01:00
358fd7d687
vars 2024-03-25 12:26:38 +01:00
003deb6455
split 2024-03-25 09:02:43 +01:00
e0839547da
.sh 2024-03-25 08:18:45 +01:00
4 changed files with 54 additions and 25 deletions

5
cd
View file

@ -1,5 +0,0 @@
echo 'nameserver 9.9.9.9' > '/etc/resolv.conf' \
&& apt-get update \
&& apt-get install --yes 'git' \
&& git clone "${GITHUB_SERVER_URL}/rwx.work/cd" '/usr/local/sbin' \
&& cd-bootstrap

View file

@ -1,20 +0,0 @@
# ssh
mkdir --parents ~/.ssh
echo "${CD}" > ~/.ssh/id_ed25519
unset CD
chmod 400 ~/.ssh/id_ed25519
echo -n "\
|1|BcccCTMLpM9HHSgJmPu/FFOwOv0=|+3BKK02xibpCPxQ9Nghi2GbXLng= \
ssh-ed25519 \
AAAAC3NzaC1lZDI1NTE5AAAAIPHCNcgHlQoiNTXfnUZYvHz9OZwYsmBCrSSV7a7Zche5
" > ~/.ssh/known_hosts
# packages
apt-get install --yes \
'python3' \
'rsync' \
'tree' \

27
cd-bootstrap.sh Executable file
View file

@ -0,0 +1,27 @@
KEY_ALGORITHM='ed25519'
KEY_DIRECTORY='.ssh'
KEY_PATH="${KEY_DIRECTORY}/id_${KEY_ALGORITHM}"
KEY_PUBLIC='AAAAC3NzaC1lZDI1NTE5AAAAIPHCNcgHlQoiNTXfnUZYvHz9OZwYsmBCrSSV7a7Zche5'
PACKAGES=(
'python3'
'rsync'
'tree'
)
SERVER="$(basename ${GITHUB_SERVER_URL})"
# ssh
cd \
|| exit
mkdir "${KEY_DIRECTORY}" \
|| exit
echo "${CD}" > "${KEY_PATH}" \
|| exit
unset CD
chmod '400' "${KEY_PATH}" \
|| exit
echo "${SERVER} ssh-${KEY_ALGORITHM} ${KEY_PUBLIC}" \
> "${KEY_DIRECTORY}/known_hosts" \
|| exit
# packages
apt-get install --yes "${PACKAGES[@]}"

27
cd.sh Normal file
View file

@ -0,0 +1,27 @@
NAMESERVERS=(
'9.9.9.9'
)
PACKAGES=(
'git'
)
REPOSITORY='rwx.work/cd'
TARGET='/usr/local/sbin'
for nameserver in "${NAMESERVERS[@]}" ; do
echo "nameserver ${nameserver}" \
>> '/etc/resolv.conf' \
|| exit
done
apt-get update \
|| exit
apt-get install --yes "${PACKAGES[@]}" \
|| exit
git clone \
"${GITHUB_SERVER_URL}/${REPOSITORY}" \
"${TARGET}" \
|| exit
cd-bootstrap.sh