2024-04-26 11:38:38 +00:00
|
|
|
CD_DNS_SERVERS=(
|
2024-03-25 11:26:38 +00:00
|
|
|
'9.9.9.9'
|
|
|
|
)
|
2024-04-26 11:38:38 +00:00
|
|
|
CD_REPOSITORY='rwx.work/cd'
|
|
|
|
|
|
|
|
CD_DNS_FILE='/etc/resolv.conf'
|
|
|
|
case "${CD_OS_NAME}" in
|
|
|
|
'debian')
|
|
|
|
case "${CD_OS_VERSION}" in
|
|
|
|
'bookworm')
|
|
|
|
echo 'bookworm!'
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo 'CD_OS_VERSION'
|
|
|
|
exit 2
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo 'CD_OS_NAME'
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2024-03-25 11:26:38 +00:00
|
|
|
|
2024-04-26 11:44:31 +00:00
|
|
|
function split {
|
|
|
|
[ "${1}" ] && echo "
|
|
|
|
${1}
|
2024-04-25 14:01:18 +00:00
|
|
|
"
|
2024-04-26 11:44:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
split " 1/14 set name servers"
|
2024-04-26 11:38:38 +00:00
|
|
|
for server in "${CD_DNS_SERVERS[@]}" ; do
|
|
|
|
echo "nameserver ${server}" \
|
|
|
|
>> "${CD_DNS_FILE}" \
|
2024-03-25 11:26:38 +00:00
|
|
|
|| exit
|
|
|
|
done
|
|
|
|
|
2024-04-26 11:44:31 +00:00
|
|
|
split " 2/14 configure package manager"
|
2024-04-05 15:49:25 +00:00
|
|
|
echo -n "\
|
2024-04-25 13:33:58 +00:00
|
|
|
Acquire::Check-Valid-Until True;
|
2024-04-05 15:49:25 +00:00
|
|
|
APT::Get::Show-Versions True;
|
2024-04-08 08:07:37 +00:00
|
|
|
APT::Install-Recommends False;
|
|
|
|
APT::Install-Suggests False;
|
2024-04-25 13:33:58 +00:00
|
|
|
Dir::Etc::SourceParts '';
|
2024-04-05 15:49:25 +00:00
|
|
|
" > '/etc/apt/apt.conf.d/apt.conf' \
|
|
|
|
|| exit
|
2024-04-26 11:44:31 +00:00
|
|
|
split " 3/14 configure package repositories"
|
2024-04-25 13:30:32 +00:00
|
|
|
echo -n "\
|
|
|
|
deb https://deb.debian.org/debian bookworm main
|
2024-04-25 13:33:58 +00:00
|
|
|
deb https://deb.debian.org/debian bookworm-backports main
|
|
|
|
deb https://deb.debian.org/debian bookworm-updates main
|
2024-04-25 13:30:32 +00:00
|
|
|
deb https://deb.debian.org/debian-security bookworm-security main
|
|
|
|
" > '/etc/apt/sources.list' \
|
|
|
|
|| exit
|
|
|
|
|
2024-04-26 11:44:31 +00:00
|
|
|
split " 4/14 disable package verification"
|
2024-04-25 14:10:57 +00:00
|
|
|
echo -n "\
|
|
|
|
Acquire::https::Verify-Peer False;
|
|
|
|
" > '/etc/apt/apt.conf.d/https' \
|
|
|
|
|| exit
|
2024-04-26 11:44:31 +00:00
|
|
|
split " 5/14 update package catalog"
|
2024-04-25 13:30:32 +00:00
|
|
|
apt-get update \
|
|
|
|
|| exit
|
2024-04-26 11:44:31 +00:00
|
|
|
split " 6/14 install CA certificates package"
|
2024-04-25 13:30:32 +00:00
|
|
|
apt-get install --yes 'ca-certificates' \
|
|
|
|
|| exit
|
2024-04-26 11:44:31 +00:00
|
|
|
split " 7/14 enable package verification"
|
2024-04-25 14:10:57 +00:00
|
|
|
rm '/etc/apt/apt.conf.d/https' \
|
|
|
|
|| exit
|
|
|
|
|
2024-04-26 11:44:31 +00:00
|
|
|
split " 8/14 update package catalog"
|
2024-03-25 08:02:43 +00:00
|
|
|
apt-get update \
|
2024-03-25 11:26:38 +00:00
|
|
|
|| exit
|
2024-04-26 11:44:31 +00:00
|
|
|
split " 9/14 upgrade packages"
|
2024-04-25 13:30:32 +00:00
|
|
|
apt-get upgrade --yes \
|
|
|
|
|| exit
|
|
|
|
|
2024-04-26 11:44:31 +00:00
|
|
|
split "10/14 install Git"
|
2024-04-25 13:30:32 +00:00
|
|
|
apt-get install --yes 'git' \
|
2024-03-25 11:26:38 +00:00
|
|
|
|| exit
|
|
|
|
|
2024-03-25 19:09:04 +00:00
|
|
|
DIRECTORY="$(mktemp --directory)" \
|
|
|
|
|| exit
|
2024-04-26 11:44:31 +00:00
|
|
|
split "11/14 clone Continuous Delivery"
|
2024-03-25 08:02:43 +00:00
|
|
|
git clone \
|
2024-04-26 11:38:38 +00:00
|
|
|
"${GITHUB_SERVER_URL}/${CD_REPOSITORY}" \
|
2024-03-25 19:09:04 +00:00
|
|
|
"${DIRECTORY}" \
|
2024-03-25 11:26:38 +00:00
|
|
|
|| exit
|
2024-04-25 13:30:32 +00:00
|
|
|
|
2024-04-26 11:44:31 +00:00
|
|
|
split "12/14 install Python"
|
2024-04-25 13:30:32 +00:00
|
|
|
apt-get install --yes 'python3' \
|
|
|
|
|| exit
|
2024-04-26 11:44:31 +00:00
|
|
|
split "13/14 clean package cache"
|
2024-04-25 13:38:28 +00:00
|
|
|
apt-get clean \
|
|
|
|
|| exit
|
2024-04-26 11:44:31 +00:00
|
|
|
split "14/14 bootstrap"
|
2024-03-25 19:09:04 +00:00
|
|
|
"${DIRECTORY}/bootstrap.sh"
|