From baa7f8a9584c0b8aebc1ae71216cbc693913983c Mon Sep 17 00:00:00 2001 From: JPyke3 Date: Mon, 7 Sep 2020 17:44:57 +1000 Subject: [PATCH] Added docker build script --- Dockerfile | 8 +++--- build-in-docker.sh | 72 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 4 deletions(-) create mode 100755 build-in-docker.sh diff --git a/Dockerfile b/Dockerfile index e431055..fc3b87b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,6 @@ +# mbp-manjaro Dockerfile +# Author: github.com/JPyke3 + FROM manjarolinux/base MAINTAINER jpyke3 @@ -14,11 +17,8 @@ RUN pacman -S manjaro-tools-iso-git \ git \ lsb-release --noconfirm -RUN mkdir ~/.config -RUN cp -r /etc/manjaro-tools ~/.config -RUN sed -i "s/# use_overlayfs=\"false\"/use_overlayfs=\"false\"/g" ~/.config/manjaro-tools/manjaro-tools.conf - # Clone the repository into container RUN git clone https://github.com/JPyke3/mbp-manjaro ~/iso-profiles +# Import my Pacman GPG key RUN pacman-key --recv-key 2BA2DFA128BBD111034F7626C7833DB15753380A --keyserver keyserver.ubuntu.com diff --git a/build-in-docker.sh b/build-in-docker.sh new file mode 100755 index 0000000..30a8dcb --- /dev/null +++ b/build-in-docker.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# Author: github.com/jpyke3 + +# The help screen +print_help() { + echo " Manjaro MBP Docker Build Scripts" + echo "" + echo " Example Usage:" + echo " build-in-docker -k linux57 -p gnome" + echo "" + echo " Arguments:" + echo " k Specify which kernel version" + echo " p Specify which manjaro edition (xfce, gnome, kde, i3, cinnamon, budgie)" + echo " h Show this help file" + exit 1 +} + +# Function to run the docker commands +run_docker() { + + # Make an out dir for the compiled ISO + mkdir ~/manjaro-mbp-iso + + # Docker command + docker run --privileged \ + -v ~/manjaro-mbp-iso:/root/out \ + jpyke3/mbp-manjaro-buildiso\ + buildiso -f\ + -p $EDITION\ + -k $KERNEL\ + -t /root/out +} + +# Check to make sure docker is installed +if [ ! -f /bin/docker ]; then + echo "You need to install docker in order to run this script!" + exit 1 +fi + +# Handle input flags +while getopts ":k:p:h:" opt; do + # Read the options from the flags + case $opt in + k) + KERNEL=$OPTARG + ;; + p) + EDITION=$OPTARG + ;; + h) + print_help + ;; + :) + if [ $OPTARG == "h" ]; then + print_help + else + echo "Option -$OPTARG requires an argument!" + exit 1 + fi + ;; + esac +done + +# Check if the two environment variables are set +if [ ! -z "$KERNEL" ] && [ ! -z "$EDITION" ]; then + run_docker +else + echo "You need to run this script with a Kernel Argument and an Edition" + echo "For more information use the -h flag for help" + exit 1 +fi +