Scaffold the new structure for building base boxes
This commit is contained in:
parent
1d28e3d213
commit
f070e9ec5b
7 changed files with 81 additions and 0 deletions
15
boxes/Makefile
Normal file
15
boxes/Makefile
Normal file
|
@ -0,0 +1,15 @@
|
|||
UBUNTU_BOXES= precise quantal raring saucy trusty
|
||||
TODAY=$(shell date -u +"%Y-%m-%d")
|
||||
|
||||
default:
|
||||
|
||||
all: $(UBUNTU_BOXES)
|
||||
|
||||
$(UBUNTU_BOXES): CONTAINER = "vagrant-lxc-base-${@}-amd64-${TODAY}"
|
||||
$(UBUNTU_BOXES): PACKAGE = "output/$(CONTAINER).box"
|
||||
$(UBUNTU_BOXES):
|
||||
@sudo -E ./mk-ubuntu.sh $(@) amd64 $(CONTAINER) $(PACKAGE)
|
||||
|
||||
clean:
|
||||
@echo "Implement clean"
|
||||
@exit 1
|
5
boxes/common/download.sh
Executable file
5
boxes/common/download.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo " Will check if the '${CONTAINER}' exists and error if doesnt"
|
||||
echo " Will create '${CONTAINER}'"
|
7
boxes/common/package.sh
Executable file
7
boxes/common/package.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
container_name=$1
|
||||
package=$2
|
||||
|
||||
echo " Will package '${container_name}' as '${package}'"
|
6
boxes/common/prepare-vagrant-user.sh
Executable file
6
boxes/common/prepare-vagrant-user.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
container_name=$1
|
||||
|
||||
echo " Will prepare the vagrant user on '${container_name}'"
|
6
boxes/debian/clean.sh
Executable file
6
boxes/debian/clean.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
container_name=$1
|
||||
|
||||
echo " Will cleanup '${container_name}'"
|
6
boxes/debian/install-extras.sh
Executable file
6
boxes/debian/install-extras.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
container_name=$1
|
||||
|
||||
echo " Will install extras for '${container_name}'"
|
36
boxes/mk-ubuntu.sh
Executable file
36
boxes/mk-ubuntu.sh
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo "You should run this script as root (sudo)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export NO_COLOR='\033[0m'
|
||||
export OK_COLOR='\033[32;01m'
|
||||
export ERROR_COLOR='\033[31;01m'
|
||||
export WARN_COLOR='\033[33;01m'
|
||||
|
||||
export DISTRIBUTION="ubuntu"
|
||||
export RELEASE=$1
|
||||
export ARCH=$2
|
||||
export CONTAINER=$3
|
||||
export PACKAGE=$4
|
||||
|
||||
if [ -f ${PACKAGE} ]; then
|
||||
echo -e "${WARN_COLOR}==> The box '${PACKAGE}' already exists, skipping...${NO_COLOR}"
|
||||
echo
|
||||
exit
|
||||
fi
|
||||
|
||||
echo -e "${OK_COLOR}==> Building '${RELEASE} (${ARCH})' to '${PACKAGE}'...${NO_COLOR}"
|
||||
|
||||
./common/download.sh ubuntu ${RELEASE} ${ARCH} ${CONTAINER}
|
||||
./common/prepare-vagrant-user.sh ${CONTAINER}
|
||||
./debian/install-extras.sh ${CONTAINER}
|
||||
./debian/clean.sh ${CONTAINER}
|
||||
./common/package.sh ${CONTAINER} ${PACKAGE}
|
||||
touch $PACKAGE
|
||||
|
||||
echo -e "${OK_COLOR}==> Finished building '${RELEASE} (${ARCH})' to '${PACKAGE}'...${NO_COLOR}"
|
||||
echo
|
Loading…
Reference in a new issue