Travis (#269)
* Update build-all.sh * Delete ovf-create.sh * Update patches.sh * Update hdd-image.sh * Create .travis.yml * Update hdd-image.sh * Update hdd-image.sh * Update hdd-image.sh * Update hdd-image.sh * Update ota.sh * Update post-build.sh * Update post-image.sh * Update rauc.sh * Update rootfs-layer.sh * Update hassos-cli * Update hassos-supervisor * Update hassos-config * Update hassos-apparmor * Update hassos-expand * Update hassos-persists-journald * Update hassos-rate * Update hassos-hook.sh * Update hassos-hook.sh * Rename uboot-boot.sh to uboot-boot.ush * Rename uboot-boot.sh to uboot-boot.ush * Update hassos-hook.sh * Rename uboot-boot.sh to uboot-boot.ush * Rename uboot-boot.sh to uboot-boot.ush * Update hassos-hook.sh * Update odroid_c2_defconfig * Update rpi0_w_defconfig * Update rpi2_defconfig * Update rpi3_64_defconfig * Update rpi3_defconfig * Update rpi_defconfig * Update tinker_defconfig * Update enter.sh * Update .travis.yml
This commit is contained in:
@@ -15,31 +15,31 @@ CACHE_DIR="${PROFILES_DIR}/cache"
|
||||
REMOVE_DIR="${PROFILES_DIR}/remove"
|
||||
|
||||
# Check folder structure
|
||||
mkdir -p ${PROFILES_DIR}
|
||||
mkdir -p ${CACHE_DIR}
|
||||
mkdir -p ${REMOVE_DIR}
|
||||
mkdir -p "${PROFILES_DIR}"
|
||||
mkdir -p "${CACHE_DIR}"
|
||||
mkdir -p "${REMOVE_DIR}"
|
||||
|
||||
# Load/Update exists/new profiles
|
||||
for profile in ${PROFILES_DIR}/*; do
|
||||
if [ ! -f ${profile} ]; then
|
||||
for profile in "${PROFILES_DIR}"/*; do
|
||||
if [ ! -f "${profile}" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Load Profile
|
||||
if ! apparmor_parser -r -W -L ${CACHE_DIR} ${profile}; then
|
||||
if ! apparmor_parser -r -W -L "${CACHE_DIR}" "${profile}"; then
|
||||
echo "[Error]: Can't load profile ${profile}"
|
||||
fi
|
||||
done
|
||||
|
||||
# Cleanup old profiles
|
||||
for profile in ${REMOVE_DIR}/*; do
|
||||
if [ ! -f ${profile} ]; then
|
||||
for profile in "${REMOVE_DIR}"/*; do
|
||||
if [ ! -f "${profile}" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Unload Profile
|
||||
if apparmor_parser -R -W -L ${CACHE_DIR} ${profile}; then
|
||||
if rm ${profile}; then
|
||||
if apparmor_parser -R -W -L "${CACHE_DIR}" "${profile}"; then
|
||||
if rm "${profile}"; then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1,41 +1,42 @@
|
||||
#!/bin/sh
|
||||
# shellcheck disable=SC2039
|
||||
set -e
|
||||
|
||||
DEVICE_CHILD="$(findfs LABEL="hassos-data")"
|
||||
DEVICE_ROOT="/dev/$(lsblk -no pkname ${DEVICE_CHILD})"
|
||||
DEVICE_ROOT="/dev/$(lsblk -no pkname "${DEVICE_CHILD}")"
|
||||
PART_NUM="${DEVICE_CHILD: -1}"
|
||||
|
||||
if sfdisk -dq ${DEVICE_ROOT} | grep -q 'label: gpt'; then
|
||||
if sfdisk -dq "${DEVICE_ROOT}" | grep -q 'label: gpt'; then
|
||||
|
||||
# Need resize
|
||||
if [ $(sgdisk -E ${DEVICE_ROOT}) -le 2048 ]; then
|
||||
if [ "$(sgdisk -E "${DEVICE_ROOT}")" -le "2048" ]; then
|
||||
echo "[INFO] No resize of data partition needed"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Resize & Reload partition
|
||||
echo "[INFO] Update hassos-data partition ${PART_NUM}"
|
||||
sgdisk -e ${DEVICE_ROOT}
|
||||
sgdisk -d ${PART_NUM} -n ${PART_NUM}:0:0 -c ${PART_NUM}:"hassos-data" -t ${PART_NUM}:"0FC63DAF-8483-4772-8E79-3D69D8477DE4" -u ${PART_NUM}:"a52a4597-fa3a-4851-aefd-2fbe9f849079" ${DEVICE_ROOT}
|
||||
sgdisk -v ${DEVICE_ROOT}
|
||||
sgdisk -e "${DEVICE_ROOT}"
|
||||
sgdisk -d "${PART_NUM}" -n "${PART_NUM}:0:0" -c "${PART_NUM}:hassos-data" -t "${PART_NUM}:0FC63DAF-8483-4772-8E79-3D69D8477DE4" -u "${PART_NUM}:a52a4597-fa3a-4851-aefd-2fbe9f849079" "${DEVICE_ROOT}"
|
||||
sgdisk -v "${DEVICE_ROOT}"
|
||||
else
|
||||
|
||||
# Need resize
|
||||
UNUSED=$(sfdisk -Fq ${DEVICE_ROOT} | cut -d " " -f 3 | tail -1)
|
||||
if [ -z "${UNUSED}" ] || [ ${UNUSED} -le 2048 ]; then
|
||||
UNUSED=$(sfdisk -Fq "${DEVICE_ROOT}" | cut -d " " -f 3 | tail -1)
|
||||
if [ -z "${UNUSED}" ] || [ "${UNUSED}" -le "2048" ]; then
|
||||
echo "[INFO] No resize of data partition needed"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo ", +" | sfdisk -N ${PART_NUM} ${DEVICE_ROOT} --force
|
||||
sfdisk -V ${DEVICE_ROOT}
|
||||
echo ", +" | sfdisk -N "${PART_NUM}" "${DEVICE_ROOT}" --force
|
||||
sfdisk -V "${DEVICE_ROOT}"
|
||||
fi
|
||||
|
||||
partx -u ${DEVICE_ROOT}
|
||||
partx -u "${DEVICE_ROOT}"
|
||||
|
||||
# Resize filesystem
|
||||
echo "[INFO] Resize hassos-data filesystem"
|
||||
e2fsck -y ${DEVICE_CHILD}
|
||||
resize2fs -f ${DEVICE_CHILD}
|
||||
e2fsck -y "${DEVICE_CHILD}"
|
||||
resize2fs -f "${DEVICE_CHILD}"
|
||||
|
||||
echo "[INFO] Finish hassos-data resizing"
|
||||
|
||||
@@ -2,20 +2,18 @@
|
||||
set -e
|
||||
|
||||
MACHINE_ID=$(cat /etc/machine-id)
|
||||
CURRENT_LOGS=/var/log/journal/${MACHINE_ID}
|
||||
|
||||
# Loop all logs folder and move
|
||||
for log_folder in /var/log/journal/*; do
|
||||
# Not a log folder
|
||||
if [ ! -d ${log_folder} ]; then
|
||||
if [ ! -d "${log_folder}" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Current log folder
|
||||
if (echo ${log_folder} | grep ${MACHINE_ID}); then
|
||||
if (echo "${log_folder}" | grep "${MACHINE_ID}"); then
|
||||
continue
|
||||
fi
|
||||
|
||||
rm -rf ${log_folder}
|
||||
rm -rf "${log_folder}"
|
||||
done
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
# shellcheck disable=SC2112
|
||||
set -e
|
||||
|
||||
|
||||
|
||||
@@ -11,13 +11,14 @@ CLI_DATA=/mnt/data/cli
|
||||
mkdir -p ${CLI_DATA}
|
||||
|
||||
# Run CLI
|
||||
# shellcheck disable=SC2086
|
||||
docker container run \
|
||||
--rm -ti --init \
|
||||
--security-opt apparmor="${APPARMOR}" \
|
||||
-v ${CLI_DATA}:/data \
|
||||
-v /etc/machine-id:/etc/machine-id:ro \
|
||||
$DOCKER_ARGS \
|
||||
${CLI}
|
||||
"${CLI}"
|
||||
|
||||
# Jump to root shell
|
||||
if [ $? -eq 10 ]; then
|
||||
|
||||
@@ -87,9 +87,10 @@ fi
|
||||
##
|
||||
# Firmware update / Only USB
|
||||
UPTIME=$(awk '{printf "%0.f", $1}' /proc/uptime)
|
||||
if ls ${USB_CONFIG}/*.raucb > /dev/null 2>&1 && [ ${UPTIME} -ge 180 ]; then
|
||||
if ls ${USB_CONFIG}/*.raucb > /dev/null 2>&1 && [ "${UPTIME}" -ge "180" ]; then
|
||||
echo "[Info] Performe a firmware update"
|
||||
|
||||
# shellcheck disable=SC2012
|
||||
rauc_filename=$(ls ${USB_CONFIG}/*.raucb | head -n 1)
|
||||
if rauc install "${rauc_filename}"; then
|
||||
echo "[Info] Firmware update success"
|
||||
|
||||
@@ -10,16 +10,18 @@ APPARMOR="$(jq --raw-output '.supervisor_apparmor // "docker-default"' ${CONFIG_
|
||||
|
||||
# Init supervisor
|
||||
HASSOS_DATA=/mnt/data/supervisor
|
||||
HASSOS_IMAGE_ID=$(docker inspect --format='{{.Id}}' ${SUPERVISOR})
|
||||
HASSOS_IMAGE_ID=$(docker inspect --format='{{.Id}}' "${SUPERVISOR}")
|
||||
HASSOS_CONTAINER_ID=$(docker inspect --format='{{.Image}}' hassos_supervisor || echo "")
|
||||
|
||||
# Fix wrong AppArmor profiles
|
||||
if ! grep ${APPARMOR} /sys/kernel/security/apparmor/profiles > /dev/null; then
|
||||
if ! grep "${APPARMOR}" /sys/kernel/security/apparmor/profiles > /dev/null; then
|
||||
APPARMOR=docker-default
|
||||
fi
|
||||
|
||||
runSupervisor() {
|
||||
docker container rm --force hassos_supervisor || true
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
docker container run --name hassos_supervisor \
|
||||
--security-opt apparmor="${APPARMOR}" \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
@@ -29,7 +31,7 @@ runSupervisor() {
|
||||
-e SUPERVISOR_SHARE=${HASSOS_DATA} \
|
||||
-e SUPERVISOR_NAME=hassos_supervisor \
|
||||
$DOCKER_ARGS \
|
||||
${SUPERVISOR}
|
||||
"${SUPERVISOR}"
|
||||
}
|
||||
|
||||
# Run supervisor
|
||||
|
||||
Reference in New Issue
Block a user