Compare commits

...

2 Commits

Author SHA1 Message Date
Jeremy Gardais a2a9aabcf0
Use long format for options 2021-11-12 11:52:36 +01:00
Jeremy Gardais 4835bc811e
Improve cleaning of unwanted X11 packages 2021-11-12 11:27:56 +01:00
2 changed files with 31 additions and 23 deletions

Binary file not shown.

View File

@ -30,68 +30,76 @@ cp -- "${APT_SOURCES_SRC}" "${APT_SOURCES_PATH}"
# update repositories and packages
apt update
apt -y full-upgrade
apt --assume-yes full-upgrade
# Ensure to have some basic packages
apt -y install aptitude tmux vim-nox zsh
apt --assume-yes install -- aptitude tmux vim-nox zsh
# Ensure to remove some "too"-basic packages
aptitude -y remove vim-tiny
aptitude --assume-yes remove -- vim-tiny
# If no X display is expected
if [ ! "$(dpkg -l xorg)" ]; then
## Remove unwanted x11 lib
aptitude -y remove libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxmuu1 xauth
if [ "$(dpkg -l task-english)" ]; then
if [ ! "$(dpkg --list -- xorg)" ]; then
## Remove unwanted x11 libs and packages
aptitude --assume-yes remove -- libgl1 libglx-mesa0 libglx0 libice6 libsm6 \
libx11-6 libx11-data libx11-xcb1 libxau6 libxaw7 libxcb-dri2-0 libxcb-dri3-0 \
libxcb-glx0 libxcb-present0 libxcb-shape0 libxcb-shm0 libxcb-sync1 \
libxcb-xfixes0 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxdmcp6 \
libxext6 libxfixes3 libxft2 libxi6 libxinerama1 libxkbfile1 libxmu6 libxmuu1 \
libxpm4 libxrandr2 libxrender1 libxt6 libxtst6 libxv1 libxxf86dga1 \
libxxf86vm1 x11-apps x11-common x11-session-utils x11-utils x11-xkb-utils \
x11-xserver-utils xauth xbase-clients xinit
if [ "$(dpkg --list -- task-english)" ]; then
## Remove task-english
aptitude -y remove task-english iamerican ibritish ienglish-common ispell util-linux-locales wamerican
aptitude --assume-yes remove task-english iamerican ibritish ienglish-common ispell util-linux-locales wamerican
fi
else
if [ "$(dpkg -l task-english)" ]; then
if [ "$(dpkg --list -- task-english)" ]; then
## Remove task-english
aptitude -y remove task-english
aptitude --assume-yes remove task-english
fi
fi
### Documentation {{{
# Remove task-french
if [ "$(dpkg -l task-french)" ]; then
if [ "$(dpkg --list -- task-french)" ]; then
# Move default wordlist to american before remove all packages
select-default-wordlist --set-default=american
aptitude -y remove task-french
aptitude --assume-yes remove -- task-french
# Reinstall useful french doc and move back to french dict
aptitude -y install aspell-fr ifrench-gut manpages-fr wfrench
aptitude --assume-yes install -- aspell-fr ifrench-gut manpages-fr wfrench
select-default-wordlist --set-default=".*(F|f)rench.*"
fi
# Ensure to have minimal documentation
aptitude -y install man-db manpages manpages-fr
aptitude --assume-yes install -- man-db manpages manpages-fr
### }}}
### SSH {{{
# Remove task-ssh-server
if [ "$(dpkg -l task-ssh-server)" ]; then
aptitude -y remove task-ssh-server ncurses-term
if [ "$(dpkg --list -- task-ssh-server)" ]; then
aptitude --assume-yes remove -- task-ssh-server ncurses-term
fi
# Ensure to install openssh-server
aptitude -y install openssh-server openssh-sftp-server
aptitude --assume-yes install -- openssh-server openssh-sftp-server
### }}}
# Ansible dependencies
aptitude -y install python3-apt
aptitude --assume-yes install -- python3-apt
### Tasksel {{{
# If tasksel and tasksel-data are the only task* relative packages
if [ "$(dpkg -l | grep -c '^ii task')" -eq "2" ]; then
aptitude -y remove tasksel tasksel-data
if [ "$(dpkg --list -- | grep --count -- '^ii task')" -eq "2" ]; then
aptitude --assume-yes remove -- tasksel tasksel-data
fi
# purge configuration files
aptitude -y purge '~c'
aptitude --assume-yes purge -- '~c'
### }}}
@ -103,9 +111,9 @@ aptitude -y purge '~c'
EFI_PATH="/boot/efi"
if [ -d "${EFI_PATH}" ]; then
## Install grub-efi
aptitude install -y grub-efi-amd64
aptitude --assume-yes install -- grub-efi-amd64
## Get grub device (keep only some patterns, eg. /dev/sda, /dev/vda, /dev/nvme0n1,…)
GRUB_DEVICE=$(sed -n "s;^\(/dev/[a-z]\{3\}\|/dev/nvme[a-z0-9]\{3\}\)\(p[0-9]\|[0-9]\) ${EFI_PATH} .*;\1;p" /etc/mtab)
GRUB_DEVICE=$(sed --silent "s;^\(/dev/[a-z]\{3\}\|/dev/nvme[a-z0-9]\{3\}\)\(p[0-9]\|[0-9]\) ${EFI_PATH} .*;\1;p" /etc/mtab)
grub-install --target=x86_64-efi "${GRUB_DEVICE}" 2>/dev/null
if [ -d "${EFI_PATH}"/EFI ]; then
## Copy efi entries to a boot directory