#!/usr/bin/env bash function is-installed() { type "${1}" } function start-docker() { is-installed "systemctl" || return $? is-installed "docker" || return $? res="$(systemctl show --property ActiveState docker)" || return $? case "${res}" in "ActiveState=active") # Docker service is active ;; "ActiveState=inactive") # Docker service is inactive -> Let's start it echo "Starting docker service ..." sudo systemctl start docker || return $? ;; *) echo "Unknown state or error!" return 1 esac } function build-pkg() { sudo docker-compose run makepkg "${1}" } function main() { start-docker || return $? is-installed "docker-compose" || return $? PKGS=(xorg-meta de-p1st-systemd de-p1st-sudo de-p1st-screen de-p1st-pacman de-p1st-pacman-mirrorlist de-p1st-networkmanager de-p1st-ucode-placeholder de-p1st-ucode-intel de-p1st-ucode-amd de-p1st-nano de-p1st-mkinitcpio de-p1st-makepkg de-p1st-grub de-p1st-font de-p1st-keyboard-de de-p1st-keyboard-x11-de de-p1st-gnupg de-p1st-redshift de-p1st-theme de-p1st-gpu-generic de-p1st-gpu-amdgpu de-p1st-installer de-p1st-repo) for PKG in "${PKGS[@]}"; do build-pkg "${PKG}" || return $? done echo "Successfully built all packages!" } main "$@"