summaryrefslogtreecommitdiff
path: root/config/install.sh
blob: 2c7a45f19713393bf7c47c3087c50418e4039a33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
set -euo pipefail

export DEBIAN_FRONTEND=noninteractive

echo -e "section_start:$(date +%s):install_packages\r\e[0K==> Installing packages…"
apt-get clean
apt-get update -q
apt-get install -y --no-install-recommends \
  apt-transport-https \
  autoconf \
  automake \
  bsdmainutils \
  bzip2 \
  ca-certificates \
  cmake \
  curl \
  git \
  gnupg2 \
  jq \
  make \
  pkg-config \
  re2c \
  rebar \
  sudo \
  unzip \
  zstd

dpkg --install /opt/toolcache/license*.deb
rm -fr /root
ln -s /opt/gitlab /root
echo -e "section_end:$(date +%s):install_packages\r\e[0K"

echo -e "section_start:$(date +%s):cleanup\r\e[0K==> Beginning cleanup…"
apt purge -y x11-common libx11-6 libgtk2.0-common libsensors-config ucf
apt autoremove -y

rm -fr /opt/gitlab/.config/configstore/update-notifier-npm.json \
  /opt/gitlab/.config/pip/selfcheck.json \
  /opt/gitlab/.gem \
  /opt/gitlab/.npm \
  /opt/gitlab/.wget-hsts \
  /etc/emacs/* \
  /etc/fonts/* \
  /etc/ldap/* \
  /etc/systemd/* \
  /etc/X11/* \
  /lib/systemd/* \
  /usr/lib/systemd/* \
  /usr/share/calendar/* \
  /usr/share/doc-base/* \
  /usr/share/emacs/* \
  /usr/share/fonts/* \
  /usr/share/icons/* \
  /usr/share/menu/* \
  /usr/share/pixmaps/* \
  /usr/share/themes/* \
  /usr/share/X11/* \
  /usr/share/zsh/* \
  /var/cache/* \
  /var/cache/apt/archives/ \
  /var/lib/apt/lists/* \
  /var/lib/systemd/* \
  /var/log/*
echo -e "section_end:$(date +%s):cleanup\r\e[0K"

echo -e "section_start:$(date +%s):compress_files\r\e[0K==> Starting compression…"
zstd_command="/usr/bin/zstd -19 -T0"

cd /opt/gitlab
tar --use-compress-program "$zstd_command" -cf /opt/gitlab/.config.tar.zst .config &
tar --use-compress-program "$zstd_command" -cf /opt/gitlab/.m2.tar.zst .m2 &
tar --use-compress-program "$zstd_command" -cf /opt/gitlab/embedded.tar.zst embedded &

cd /usr/lib
tar --use-compress-program "$zstd_command" -cf /usr/lib/git-core.tar.zst git-core &

wait
# shellcheck disable=SC2114
rm -fr \
  /opt/gitlab/.m2 \
  /opt/gitlab/.cache \
  /opt/gitlab/.config \
  /opt/gitlab/embedded \
  /usr/lib/git-core
echo -e "section_end:$(date +%s):compress_files\r\e[0K"