#!/bin/bash
set -e

# netinstall steps:
# installation source = http://ftp.uio.no/centos/7/os/x86_64/
# software selection = minimal install
# instlalation destination:
#   [x] i will configure partitioning
#   new standard partition, mountpoint /, ext4
#
# convert sparse qcow to qcow2:
#   qemu-img convert -O qcow2 centos7.0.qcow2 centos7.1.qcow2 

vx() {
	{
		printf '\033[%s' s 2r H '0;1;37;44m'
		printf '%q ' "$@"
		printf '\033[%s' K u '7m '
		printf '%q ' "$@"
		printf '\033[%s' K 27m E
	} >&2
	"$@"
}

vx yum -y install epel-release
vx yum -y update
vx yum groups mark convert
vx yum -y groupinstall Xfce
#vx yum -y groupinstall 'LXQt Desktop'
vx yum -y install xorg-x11-drv-libinput lightdm #sddm

pkgs=(
    patch ntp dnsmasq tmux htop xsel qemu-img jq pigz zstd
    ncdu pv lbzip2 patchelf socat mc bmon siege vim strace
    network-manager-applet geany xfce4-screenshooter meld
    wireshark wireshark-gnome pngquant squashfstools git
    imagemagick telnet chromium firefox python3 chrony
    open-vm-tools-desktop xorg-x11-drv-qxl
    paper-icon-theme adapta-gtk-theme
)
vx yum -y install "${pkgs[@]}"

systemctl set-default graphical.target
