Add script runner
This commit is contained in:
parent
da84915782
commit
678c8c3c14
5 changed files with 66 additions and 82 deletions
|
@ -2,8 +2,8 @@ before_install:
|
|||
- sudo apt-get update
|
||||
- sudo apt-get install -y bash quilt parted qemu-user-static debootstrap zerofree zip dosfstools libcap2-bin grep rsync
|
||||
|
||||
install: sudo ./build.sh
|
||||
install: sudo ./run ./build.sh
|
||||
|
||||
script:
|
||||
- ./test/archive.sh
|
||||
- ./test/partition_alignment.sh
|
||||
- ./run ./test/archive.sh
|
||||
- ./run ./test/partition_alignment.sh
|
||||
|
|
57
build.sh
Executable file → Normal file
57
build.sh
Executable file → Normal file
|
@ -1,57 +1,4 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
export IMG_NAME='BarnacleOS'
|
||||
export USERNAME='user'
|
||||
export PASSWORD='password'
|
||||
|
||||
export BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
export DEPLOY_DIR="$BASE_DIR/deploy"
|
||||
export ROOTFS_DIR="$BASE_DIR/rootfs"
|
||||
export MOUNT_DIR="$BASE_DIR/mnt"
|
||||
export KEYS_DIR="$BASE_DIR/keys"
|
||||
export FILES_DIR="$BASE_DIR/files"
|
||||
export SCRIPTS="$BASE_DIR/scripts"
|
||||
|
||||
export IMG_DATE="$(date +%Y-%m-%d)"
|
||||
|
||||
export IMG_FILE="$DEPLOY_DIR/$IMG_NAME-${IMG_DATE}.img"
|
||||
export ZIP_FILE="$DEPLOY_DIR/$IMG_NAME-${IMG_DATE}.zip"
|
||||
|
||||
export QUILT_PATCHES="$BASE_DIR/patches"
|
||||
export QUILT_NO_DIFF_INDEX=1
|
||||
export QUILT_NO_DIFF_TIMESTAMPS=1
|
||||
export QUILT_REFRESH_ARGS='-p ab'
|
||||
|
||||
# dependencies_check
|
||||
# $@ Dependnecy files to check
|
||||
#
|
||||
# Each dependency is in the form of a tool to test for, optionally followed by
|
||||
# a : and the name of a package if the package on a Debian-ish system is not
|
||||
# named for the tool (i.e., qemu-user-static).
|
||||
dependencies_check() {
|
||||
local missing
|
||||
|
||||
if [[ -f "$1" ]]; then
|
||||
for dep in $(cat "$1"); do
|
||||
if ! hash ${dep%:*} 2>/dev/null; then
|
||||
missing="${missing:+$missing }${dep#*:}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ "$missing" ]]; then
|
||||
tput setaf 1 # Red color
|
||||
echo 'Reqired dependencies not installed.'
|
||||
echo 'This can be resolved on Debian/Raspbian systems by installing the following packages:'
|
||||
for package_name in $missing; do
|
||||
echo " * $package_name"
|
||||
done
|
||||
tput sgr0 # No color
|
||||
|
||||
false
|
||||
fi
|
||||
}
|
||||
#!/bin/false
|
||||
|
||||
on_chroot() {
|
||||
capsh --drop=cap_setfcap --chroot="$ROOTFS_DIR" -- "$@"
|
||||
|
@ -140,8 +87,6 @@ if [ "$(id -u)" != '0' ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
dependencies_check "$BASE_DIR/depends"
|
||||
|
||||
mkdir -p "$DEPLOY_DIR"
|
||||
mkdir -p "$MOUNT_DIR"
|
||||
|
||||
|
|
60
run
Executable file
60
run
Executable file
|
@ -0,0 +1,60 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
|
||||
|
||||
export BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
export IMG_NAME='BarnacleOS'
|
||||
export USERNAME='user'
|
||||
export PASSWORD='password'
|
||||
|
||||
export DEPLOY_DIR="$BASE_DIR/deploy"
|
||||
export ROOTFS_DIR="$BASE_DIR/rootfs"
|
||||
export MOUNT_DIR="$BASE_DIR/mnt"
|
||||
export KEYS_DIR="$BASE_DIR/keys"
|
||||
export FILES_DIR="$BASE_DIR/files"
|
||||
export SCRIPTS="$BASE_DIR/scripts"
|
||||
|
||||
export IMG_DATE="$(date +%Y-%m-%d)"
|
||||
|
||||
export IMG_FILE="$DEPLOY_DIR/$IMG_NAME-${IMG_DATE}.img"
|
||||
export ZIP_FILE="$DEPLOY_DIR/$IMG_NAME-${IMG_DATE}.zip"
|
||||
|
||||
export QUILT_PATCHES="$BASE_DIR/patches"
|
||||
export QUILT_NO_DIFF_INDEX=1
|
||||
export QUILT_NO_DIFF_TIMESTAMPS=1
|
||||
export QUILT_REFRESH_ARGS='-p ab'
|
||||
|
||||
# dependencies_check
|
||||
# $@ Dependnecy files to check
|
||||
#
|
||||
# Each dependency is in the form of a tool to test for, optionally followed by
|
||||
# a : and the name of a package if the package on a Debian-ish system is not
|
||||
# named for the tool (i.e., qemu-user-static).
|
||||
dependencies_check() {
|
||||
local missing
|
||||
|
||||
if [[ -f "$1" ]]; then
|
||||
for dep in $(cat "$1"); do
|
||||
if ! hash ${dep%:*} 2>/dev/null; then
|
||||
missing="${missing:+$missing }${dep#*:}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ "$missing" ]]; then
|
||||
tput setaf 1 # Red color
|
||||
echo 'Reqired dependencies not installed.'
|
||||
echo 'This can be resolved on Debian/Raspbian systems by installing the following packages:'
|
||||
for package_name in $missing; do
|
||||
echo " * $package_name"
|
||||
done
|
||||
tput sgr0 # No color
|
||||
|
||||
false
|
||||
fi
|
||||
}
|
||||
|
||||
dependencies_check "$BASE_DIR/depends"
|
||||
|
||||
exec bash -e $@
|
13
test/archive.sh
Executable file → Normal file
13
test/archive.sh
Executable file → Normal file
|
@ -1,15 +1,4 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
export BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
export IMG_NAME='BarnacleOS'
|
||||
|
||||
export DEPLOY_DIR="$BASE_DIR/deploy"
|
||||
|
||||
export IMG_DATE="$(date +%Y-%m-%d)"
|
||||
|
||||
export IMG_FILE="$DEPLOY_DIR/$IMG_NAME-${IMG_DATE}.img"
|
||||
export ZIP_FILE="$DEPLOY_DIR/$IMG_NAME-${IMG_DATE}.zip"
|
||||
#!/bin/false
|
||||
|
||||
test -f "$IMG_FILE"
|
||||
test -f "$ZIP_FILE"
|
||||
|
|
12
test/partition_alignment.sh
Executable file → Normal file
12
test/partition_alignment.sh
Executable file → Normal file
|
@ -1,14 +1,4 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
export BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
export IMG_NAME='BarnacleOS'
|
||||
|
||||
export DEPLOY_DIR="$BASE_DIR/deploy"
|
||||
|
||||
export IMG_DATE="$(date +%Y-%m-%d)"
|
||||
|
||||
export IMG_FILE="$DEPLOY_DIR/$IMG_NAME-${IMG_DATE}.img"
|
||||
#!/bin/false
|
||||
|
||||
TABLE="$(/sbin/fdisk -o Device,Start -l "$IMG_FILE" | grep "^$IMG_FILE")"
|
||||
|
||||
|
|
Reference in a new issue