From 482632b5cec071aee526f09841038c9c349b101b Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sat, 8 Jul 2017 02:42:01 +0300 Subject: [PATCH 01/14] Move FullPageOS to work with CustomPiOS --- .gitignore | 3 + README.rst | 9 +- src/build | 56 --- src/build_dist | 9 + src/common.sh | 357 ------------------ src/config | 119 +----- src/filesystem/boot/fullpageos-network.txt | 53 --- src/filesystem/home/root/bin/git | 9 - src/filesystem/home/root/bin/map_iface | 13 - src/filesystem/home/root/bin/webcamd | 122 ------ src/fullpageos | 104 ----- src/jenkins-ci/console_parsing | 4 - src/modules/fullpageos/config | 28 ++ .../filesystem/boot/fullpagedashboard.txt | 0 .../filesystem/boot/fullpageos.txt | 0 .../filesystem/home/pi/scripts/enable_gpu | 0 .../filesystem/home/pi/scripts/fullscreen | 0 .../filesystem/home/pi/scripts/refresh | 0 .../filesystem/home/pi/scripts/run_onepageos | 0 .../filesystem/home/pi/scripts/setX11vncPass | 0 .../home/pi/scripts/start_chromium_browser | 0 .../filesystem/root/etc/fullpageos_version | 0 .../usr/share/xsessions/fullpageos.desktop | 0 .../system/clear_lighttpd_cache.service | 0 .../system/enable_gpu_first_boot.service | 0 .../fullpageos/start_chroot_script} | 30 +- .../fullpageos_nightly_build | 24 -- src/release | 13 - src/vagrant/Vagrantfile | 11 +- src/vagrant/run_vagrant_build.sh | 2 +- src/vagrant/setup.sh | 2 - src/variants/example/config | 4 - src/variants/example/config.nightly | 3 - .../example/filesystem/root/etc/dhclient.conf | 0 src/variants/example/post_chroot_script | 11 - 35 files changed, 64 insertions(+), 922 deletions(-) delete mode 100755 src/build create mode 100755 src/build_dist delete mode 100755 src/common.sh delete mode 100644 src/filesystem/boot/fullpageos-network.txt delete mode 100644 src/filesystem/home/root/bin/git delete mode 100755 src/filesystem/home/root/bin/map_iface delete mode 100755 src/filesystem/home/root/bin/webcamd delete mode 100755 src/fullpageos delete mode 100644 src/jenkins-ci/console_parsing create mode 100644 src/modules/fullpageos/config rename src/{ => modules/fullpageos}/filesystem/boot/fullpagedashboard.txt (100%) rename src/{ => modules/fullpageos}/filesystem/boot/fullpageos.txt (100%) rename src/{ => modules/fullpageos}/filesystem/home/pi/scripts/enable_gpu (100%) rename src/{ => modules/fullpageos}/filesystem/home/pi/scripts/fullscreen (100%) rename src/{ => modules/fullpageos}/filesystem/home/pi/scripts/refresh (100%) rename src/{ => modules/fullpageos}/filesystem/home/pi/scripts/run_onepageos (100%) rename src/{ => modules/fullpageos}/filesystem/home/pi/scripts/setX11vncPass (100%) rename src/{ => modules/fullpageos}/filesystem/home/pi/scripts/start_chromium_browser (100%) rename src/{ => modules/fullpageos}/filesystem/root/etc/fullpageos_version (100%) rename src/{ => modules/fullpageos}/filesystem/root/usr/share/xsessions/fullpageos.desktop (100%) rename src/{ => modules/fullpageos}/filesystem/root_init/etc/systemd/system/clear_lighttpd_cache.service (100%) rename src/{ => modules/fullpageos}/filesystem/root_init/etc/systemd/system/enable_gpu_first_boot.service (100%) rename src/{chroot_script => modules/fullpageos/start_chroot_script} (82%) delete mode 100755 src/nightly_build_scripts/fullpageos_nightly_build delete mode 100755 src/release delete mode 100755 src/variants/example/config delete mode 100755 src/variants/example/config.nightly delete mode 100644 src/variants/example/filesystem/root/etc/dhclient.conf delete mode 100755 src/variants/example/post_chroot_script diff --git a/.gitignore b/.gitignore index 4774137..baebd29 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ src/config.local src/image/*.zip +src/custompios_path +src/build.log +src/vagrant/.vagrant/* diff --git a/README.rst b/README.rst index ff65230..7e68a38 100644 --- a/README.rst +++ b/README.rst @@ -46,6 +46,7 @@ Requirements ~~~~~~~~~~~~ #. `qemu-arm-static `_ +#. `CustomPiOS `_ #. Downloaded `Raspbian `_ image. #. root privileges for chroot #. Bash @@ -61,12 +62,14 @@ You can build it by issuing the following commands:: sudo apt-get install realpath qemu-user-static + git clone https://github.com/guysoft/CustomPiOS.git git clone https://github.com/guysoft/FullPageOS.git cd FullPageOS/src/image curl -J -O -L http://downloads.raspberrypi.org/raspbian_latest cd .. + ../../CustomPiOS/src/update-custompios-paths sudo modprobe loop - sudo bash -x ./build + sudo bash -x ./build_dist Building FullPageOS Variants ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -75,7 +78,7 @@ FullPageOS supports building variants, which are builds with changes from the ma To build a variant use:: - sudo bash -x ./build [Variant] + sudo bash -x ./build_dist [Variant] Building Using Vagrant ~~~~~~~~~~~~~~~~~~~~~~ @@ -103,7 +106,7 @@ Usage ~~~~~ #. If needed, override existing config settings by creating a new file ``src/config.local``. You can override all settings found in ``src/config``. If you need to override the path to the Raspbian image to use for building OctoPi, override the path to be used in ``ZIP_IMG``. By default, the most recent file matching ``*-raspbian.zip`` found in ``src/image`` will be used. -#. Run ``src/build`` as root. +#. Run ``src/build_dist`` as root. #. The final image will be created in ``src/workspace`` Code contribution would be appreciated! diff --git a/src/build b/src/build deleted file mode 100755 index 58929b0..0000000 --- a/src/build +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash - -set -e - -[ -n "$LOG" ] || LOG="build.log" - -define(){ IFS='\n' read -r -d '' ${1} || true; } - -define SCRIPT <<'EOF' -BUILD_SCRIPT__PATH=$(dirname $(realpath -s $BASH_SOURCE)) -source ${BUILD_SCRIPT__PATH}/common.sh - -FULLPAGEOS_PATH=$(dirname $(realpath -s $0)) -pushd $FULLPAGEOS_PATH - export FULLPAGEOS_COMMIT=`git rev-parse HEAD` -popd - -BUILD_VARIANT=default -BUILD_FLAVOR=default -WORKSPACE_POSTFIX= - -if [ "$#" -gt 0 ]; then - BUILD_VARIANT=$1 -fi -if [ "$#" -gt 1 ]; then - BUILD_FLAVOR=$2 -fi - -if [ $BUILD_VARIANT != 'default' ]; then - WORKSPACE_POSTFIX=-$BUILD_VARIANT - - export VARIANT_BASE="$FULLPAGEOS_PATH/variants/$BUILD_VARIANT" - [ -d $VARIANT_BASE ] || die "Could not find Variant $BUILD_VARIANT" - - if [ $BUILD_FLAVOR == '' ] || [ $BUILD_FLAVOR == 'default' ] - then - VARIANT_CONFIG=$VARIANT_BASE/config - FLAVOR_CONFIG= - else - VARIANT_CONFIG=$VARIANT_BASE/config - FLAVOR_CONFIG=$VARIANT_BASE/config.$BUILD_FLAVOR - fi - - if [ -n "$FLAVOR_CONFIG" ] && [ ! -f $FLAVOR_CONFIG ] - then - die "Could not find config file $FLAVOR_CONFIG" - fi -fi - -echo -e "--> Building VARIANT $BUILD_VARIANT, FLAVOR $BUILD_FLAVOR" - -source $FULLPAGEOS_PATH/config -[ "$CONFIG_ONLY" == "yes" ] || source $FULLPAGEOS_PATH/fullpageos -EOF - -[ "$LOG" != "no" ] && (eval "$SCRIPT" 2>&1 | tee "$LOG") || eval "$SCRIPT" diff --git a/src/build_dist b/src/build_dist new file mode 100755 index 0000000..789cc56 --- /dev/null +++ b/src/build_dist @@ -0,0 +1,9 @@ +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +export DIST_PATH=${DIR} +export CUSTOM_PI_OS_PATH=$(<${DIR}/custompios_path) +export PATH=$PATH:$CUSTOM_PI_OS_PATH +echo ${CUSTOM_PI_OS_PATH} + +${CUSTOM_PI_OS_PATH}/build_custom_os ${DIST_PATH} + diff --git a/src/common.sh b/src/common.sh deleted file mode 100755 index f6d30a1..0000000 --- a/src/common.sh +++ /dev/null @@ -1,357 +0,0 @@ -#!/usr/bin/env bash - -function die () { - echo >&2 "$@" - exit 1 -} - -function fixLd(){ - sed -i 's@/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so@\#/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so@' etc/ld.so.preload - sed -i 's@/usr/lib/arm-linux-gnueabihf/libarmmem.so@\#/usr/lib/arm-linux-gnueabihf/libarmmem.so@' etc/ld.so.preload -} - -function restoreLd(){ - sed -i 's@\#/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so@/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so@' etc/ld.so.preload - sed -i 's@\#/usr/lib/arm-linux-gnueabihf/libarmmem.so@/usr/lib/arm-linux-gnueabihf/libarmmem.so@' etc/ld.so.preload -} - -function pause() { - # little debug helper, will pause until enter is pressed and display provided - # message - read -p "$*" -} - -function gitclone(){ - # call like this: gitclone FULLPAGEOS_REPO someDirectory -- this will do: - # - # sudo -u pi git clone -b $FULLPAGEOS_REPO_BRANCH --depth $FULLPAGEOS_REPO_DEPTH $FULLPAGEOS_REPO_BUILD someDirectory - # - # and if $FULLPAGEOS_REPO_BUILD != $FULLPAGEOS_REPO_SHIP also: - # - # pushd someDirectory - # sudo -u pi git remote set-url origin $FULLPAGEOS_REPO_SHIP - # popd - # - # if second parameter is not provided last URL segment of the BUILD repo URL - # minus the optional .git postfix will be used - - repo_build_var=$1_BUILD - repo_ship_var=$1_SHIP - repo_branch_var=$1_BRANCH - repo_depth_var=$1_DEPTH - - repo_dir=$2 - if [ ! -n "$repo_dir" ] - then - repo_dir=$(echo ${REPO} | sed 's%^.*/\([^/]*\)\(\.git\)?$%\1%g') - fi - - repo_depth=${!repo_depth_var} - if [ -n "$repo_depth" ] - then - depth=$repo_depth - else - if [ "$#" -gt 2 ] - then - depth=$3 - fi - fi - - build_repo=${!repo_build_var} - ship_repo=${!repo_ship_var} - branch=${!repo_branch_var} - - if [ ! -n "$build_repo" ] - then - build_repo=$ship_repo - fi - - clone_params= - if [ -n "$branch" ] - then - clone_params="-b $branch" - fi - - if [ -n "$depth" ] - then - clone_params="$clone_params --depth $depth" - fi - - sudo -u pi git clone $clone_params "$build_repo" "$repo_dir" - - if [ "$build_repo" != "$ship_repo" ] - then - pushd "$repo_dir" - sudo -u pi git remote set-url origin "$ship_repo" - popd - fi -} - -function unpack() { - # call like this: unpack /path/to/source /target user -- this will copy - # all files & folders from source to target, preserving mode and timestamps - # and chown to user. If user is not provided, no chown will be performed - - from=$1 - to=$2 - owner= - if [ "$#" -gt 2 ] - then - owner=$3 - fi - - # $from/. may look funny, but does exactly what we want, copy _contents_ - # from $from to $to, but not $from itself, without the need to glob -- see - # http://stackoverflow.com/a/4645159/2028598 - cp -v -r --preserve=mode,timestamps $from/. $to - if [ -n "$owner" ] - then - chown -hR $owner:$owner $to - fi -} - -function mount_image() { - image_path=$1 - mount_path=$2 - - # dump the partition table, locate boot partition and root partition - boot_partition=1 - root_partition=2 - fdisk_output=$(sfdisk -d $image_path) - boot_offset=$(($(echo "$fdisk_output" | grep "$image_path$boot_partition" | awk '{print $4-0}') * 512)) - root_offset=$(($(echo "$fdisk_output" | grep "$image_path$root_partition" | awk '{print $4-0}') * 512)) - - echo "Mounting image $image_path on $mount_path, offset for boot partition is $boot_offset, offset for root partition is $root_offset" - - # mount root and boot partition - sudo mount -o loop,offset=$root_offset $image_path $mount_path/ - sudo mount -o loop,offset=$boot_offset,sizelimit=$( expr $root_offset - $boot_offset ) $image_path $mount_path/boot - sudo mount -o bind /dev/pts $mount_path/dev/pts -} - -function unmount_image() { - mount_path=$1 - force= - if [ "$#" -gt 1 ] - then - force=$2 - fi - - if [ -n "$force" ] - then - for process in $(sudo lsof $mount_path | awk '{print $2}') - do - echo "Killing process id $process..." - sudo kill -9 $process - done - fi - - # Unmount everything that is mounted - # - # We might have "broken" mounts in the mix that point at a deleted image (in case of some odd - # build errors). So our "sudo mount" output can look like this: - # - # /path/to/our/image.img (deleted) on /path/to/our/mount type ext4 (rw) - # /path/to/our/image.img on /path/to/our/mount type ext4 (rw) - # /path/to/our/image.img on /path/to/our/mount/boot type vfat (rw) - # - # so we split on "on" first, then do a whitespace split to get the actual mounted directory. - # Also we sort in reverse to get the deepest mounts first. - for m in $(sudo mount | grep $mount_path | awk -F "on" '{print $2}' | awk '{print $1}' | sort -r) - do - echo "Unmounting $m..." - sudo umount $m - done -} - -function cleanup() { - # make sure that all child processed die when we die - local pids=$(jobs -pr) - [ -n "$pids" ] && kill $pids && sleep 5 && kill -9 $pids - exit 0 -} - -function cleanup() { - # make sure that all child processed die when we die - local pids=$(jobs -pr) - [ -n "$pids" ] && kill $pids - exit 0 -} - -function install_fail_on_error_trap() { - set -e - trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG - trap 'if [ $? -ne 0 ]; then echo -e "\nexit $? due to $previous_command \nBUILD FAILED!" && echo "unmounting image..." && ( unmount_image $FULLPAGEOS_MOUNT_PATH force || true ); fi;' EXIT -} - -function install_chroot_fail_on_error_trap() { - set -e - trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG - trap 'if [ $? -ne 0 ]; then echo -e "\nexit $? due to $previous_command \nBUILD FAILED!"; fi;' EXIT -} - -function install_cleanup_trap() { - set -e - trap "cleanup" SIGINT SIGTERM - } - -function enlarge_ext() { - # call like this: enlarge_ext /path/to/image partition size - # - # will enlarge partition number on /path/to/image by MB - image=$1 - partition=$2 - size=$3 - - echo "Adding $size MB to partition $partition of $image" - start=$(sfdisk -d $image | grep "$image$partition" | awk '{print $4-0}') - offset=$(($start*512)) - dd if=/dev/zero bs=1M count=$size >> $image - fdisk $image < on /path/to/image to MB - image=$1 - partition=$2 - size=$3 - - echo "Resizing file system to $size MB..." - start=$(sfdisk -d $image | grep "$image$partition" | awk '{print $4-0}') - offset=$(($start*512)) - - LODEV=$(losetup -f --show -o $offset $image) - trap 'losetup -d $LODEV' EXIT - - e2fsck -fy $LODEV - - e2ftarget_bytes=$(($size * 1024 * 1024)) - e2ftarget_blocks=$(($e2ftarget_bytes / 512 + 1)) - - echo "Resizing file system to $e2ftarget_blocks blocks..." - resize2fs $LODEV ${e2ftarget_blocks}s - losetup -d $LODEV - trap - EXIT - - new_end=$(($start + $e2ftarget_blocks)) - - echo "Resizing partition to end at $start + $e2ftarget_blocks = $new_end blocks..." - fdisk $image </dev/null | grep -i "minimum size" | awk -F: '{print $2-0}') - - e2fminsize_bytes=$(($e2fminsize * $e2fblocksize)) - e2ftarget_bytes=$(($buffer * 1024 * 1024 + $e2fminsize_bytes)) - e2fsize_bytes=$((($e2fsize_blocks - 1) * 512)) - - e2fminsize_mb=$(($e2fminsize_bytes / 1024 / 1024)) - e2fminsize_blocks=$(($e2fminsize_bytes / 512 + 1)) - e2ftarget_mb=$(($e2ftarget_bytes / 1024 / 1024)) - e2ftarget_blocks=$(($e2ftarget_bytes / 512 + 1)) - e2fsize_mb=$(($e2fsize_bytes / 1024 / 1024)) - - size_offset_mb=$(($e2fsize_mb - $e2ftarget_mb)) - - losetup -d $LODEV - - echo "Actual size is $e2fsize_mb MB ($e2fsize_blocks blocks), Minimum size is $e2fminsize_mb MB ($e2fminsize file system blocks, $e2fminsize_blocks blocks)" - echo "Resizing to $e2ftarget_mb MB ($e2ftarget_blocks blocks)" - - if [ $size_offset_mb -gt 0 ]; then - echo "Partition size is bigger then the desired size, shrinking" - shrink_ext $image 2 $(($e2ftarget_mb - 1)) # -1 to compensat rounding mistakes - elif [ $size_offset_mb -lt 0 ]; then - echo "Partition size is lower then the desired size, enlarging" - enlarge_ext $image 2 $((-$size_offset_mb + 1)) # +1 to compensat rounding mistakes - fi -} - -function is_installed(){ - # checks if a package is installed, returns 1 if installed and 0 if not. - # usage: is_installed - dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed" -} - -function is_in_apt(){ - #checks if a package is in the apt repo, returns 1 if exists and 0 if not - #usage is_in_apt - if [ $(apt-cache policy $1 | wc | awk '{print $1}') -gt 0 ]; then - echo 1 - else - echo 0 - fi -} - -systemctl_if_exists() { - if hash systemctl 2>/dev/null; then - systemctl "$@" - else - echo "no systemctl, not running" - fi -} diff --git a/src/config b/src/config index 85cb45b..92c1078 100755 --- a/src/config +++ b/src/config @@ -1,119 +1,10 @@ -CONFIG_DIR=$(dirname $(realpath -s $BASH_SOURCE)) - -# Import the variant config if we have one - -if [ -n "$VARIANT_CONFIG" ] && [ -f $VARIANT_CONFIG ] -then - echo "Sourceing variant config $VARIANT_CONFIG..." - source $VARIANT_CONFIG -fi - -# Import the flavor config if we have one - -if [ -n "$FLAVOR_CONFIG" ] && [ -f $FLAVOR_CONFIG ] -then - echo "Sourcing flavor config $FLAVOR_CONFIG..." - source $FLAVOR_CONFIG -fi - -# Import the local config if we have one - -if [ -f $CONFIG_DIR/config.local ] -then - echo "Sourcing config.local..." - source $CONFIG_DIR/config.local -fi - -############################################################################### -# All our config settings must start with FULLPAGEOS_ - -[ -n "$FULLPAGEOS_SCRIPT_PATH" ] || FULLPAGEOS_SCRIPT_PATH=$CONFIG_DIR -[ -n "$FULLPAGEOS_IMAGE_PATH" ] || FULLPAGEOS_IMAGE_PATH=$FULLPAGEOS_SCRIPT_PATH/image - -[ -n "$FULLPAGEOS_ZIP_IMG" ] || FULLPAGEOS_ZIP_IMG=`ls -t $FULLPAGEOS_IMAGE_PATH/*-raspbian*.zip | head -n 1` - -[ -n "$FULLPAGEOS_WORKSPACE" ] || FULLPAGEOS_WORKSPACE=$FULLPAGEOS_SCRIPT_PATH/workspace$WORKSPACE_POSTFIX -[ -n "$FULLPAGEOS_CHROOT_SCRIPT_PATH" ] || FULLPAGEOS_CHROOT_SCRIPT_PATH=$FULLPAGEOS_SCRIPT_PATH/chroot_script -[ -n "$FULLPAGEOS_MOUNT_PATH" ] || FULLPAGEOS_MOUNT_PATH=$FULLPAGEOS_WORKSPACE/mount +export DIST_NAME=FullpageOS +export DIST_VERSION=0.07 +export MODULES="base(raspicam, network, fullpageos)" # if set will enlarge root parition prior to build by provided size in MB -[ -n "$FULLPAGEOS_IMAGE_ENLARGEROOT" ] || FULLPAGEOS_IMAGE_ENLARGEROOT=1000 +export BASE_IMAGE_ENLARGEROOT=1000 # if set will resize root partition on image after build to minimum size + # provided size in MB -[ -n "$FULLPAGEOS_IMAGE_RESIZEROOT" ] || FULLPAGEOS_IMAGE_RESIZEROOT=200 - -# a local directory on the build server to bind mount under /var/cache/apt -[ -n "$FULLPAGEOS_APT_CACHE" ] || FULLPAGEOS_APT_CACHE=$FULLPAGEOS_WORKSPACE/aptcache - -# a host:port combo for a apt-proxy (such as apt-cacher-ng) to use -[ -n "$FULLPAGEOS_APT_PROXY" ] || FULLPAGEOS_APT_PROXY= - -# an alternative pypi index url to use, e.g. a proxy such as devpi -[ -n "$FULLPAGEOS_PYPI_INDEX" ] || FULLPAGEOS_PYPI_INDEX= - -[ -n "$FULLPAGEOS_OVERRIDE_HOSTNAME" ] || FULLPAGEOS_OVERRIDE_HOSTNAME=fullpageos - -#override timezone, otherwise use image timezone -[ -n "$FULLPAGEOS_OVERRIDE_TIMEZONE" ] || FULLPAGEOS_OVERRIDE_TIMEZONE=default - -#override locale, otherwise use image locale -[ -n "$FULLPAGEOS_OVERRIDE_LOCALE" ] || FULLPAGEOS_OVERRIDE_LOCALE=default - -#override password, otherwise use image default -[ -n "$FULLPAGEOS_OVERRIDE_PASSWORD" ] || FULLPAGEOS_OVERRIDE_PASSWORD=default - -[ -n "$FULLPAGEOS_INCLUDE_CHROMIUM" ] || FULLPAGEOS_INCLUDE_CHROMIUM=yes -[ -n "$FULLPAGEOS_INCLUDE_LIGHTTPD" ] || FULLPAGEOS_INCLUDE_LIGHTTPD=yes - -# FullPageDashboard repo & branch -[ -n "$FULLPAGEOS_DASHBOARD_REPO_SHIP" ] || FULLPAGEOS_DASHBOARD_REPO_SHIP=https://github.com/amitdar/FullPageDashboard.git -[ -n "$FULLPAGEOS_DASHBOARD_REPO_BUILD" ] || FULLPAGEOS_DASHBOARD_REPO_BUILD= -[ -n "$FULLPAGEOS_DASHBOARD_REPO_BRANCH" ] || FULLPAGEOS_DASHBOARD_REPO_BRANCH=master -[ -n "$FULLPAGEOS_INCLUDE_DASHBOARD" ] || FULLPAGEOS_INCLUDE_DASHBOARD=yes - -# FullPageDashboard repo & branch -[ -n "$FULLPAGEOS_WELCOME_REPO_SHIP" ] || FULLPAGEOS_WELCOME_REPO_SHIP=https://github.com/tailorvj/FullPageOSWelcome.git -[ -n "$FULLPAGEOS_WELCOME_REPO_BUILD" ] || FULLPAGEOS_WELCOME_REPO_BUILD= -[ -n "$FULLPAGEOS_WELCOME_REPO_BRANCH" ] || FULLPAGEOS_WELCOME_REPO_BRANCH=master -[ -n "$FULLPAGEOS_INCLUDE_WELCOME" ] || FULLPAGEOS_INCLUDE_WELCOME=yes - -# Add GPU acceleration -[ -n "$FULLPAGEOS_INCLUDE_ACCELERATION" ] || FULLPAGEOS_INCLUDE_ACCELERATION=yes - - -############################################################################### -# Rewrite any build urls that are not yet set if we have a repository mirror -# configured. - -if [ -n "$FULLPAGEOS_BUILD_REPO_MIRROR" ] -then - vars=`compgen -A variable | grep '^FULLPAGEOS_' | grep 'REPO_BUILD'` - for var in $vars - do - if [ ! -n "${!var}" ] - then - repo_ship_var=${var%_BUILD}_SHIP - original=${!repo_ship_var} - rewritten=$FULLPAGEOS_BUILD_REPO_MIRROR`echo $original | awk -F '/' '{print $(NF)}'` - - echo "Rewriting build repo for $var from $original to $rewritten" - eval $var=$rewritten - fi - done -fi - -############################################################################### -# Print and export the final configuration. - -echo "================================================================" -echo "Using the following config:" - -vars=`compgen -A variable | grep '^FULLPAGEOS_'` -for var in $vars -do - echo "$var = ${!var}" - eval export $var -done - -echo "================================================================" +export BASE_IMAGE_RESIZEROOT=200 diff --git a/src/filesystem/boot/fullpageos-network.txt b/src/filesystem/boot/fullpageos-network.txt deleted file mode 100644 index bf8b624..0000000 --- a/src/filesystem/boot/fullpageos-network.txt +++ /dev/null @@ -1,53 +0,0 @@ -# You can use this file to manually set up your network configuration. -# -# This file is included into /etc/network/interfaces, so anything that -# works by editing that file is also possible here. - -### WIFI CONFIGURATION ###################################################### -# The three segments below should cover you in most cases if you run -# a wifi network that uses either WPA/WPA2 or WEP encryption. -# -# Just uncomment the lines prefixed with a single # of the configuration -# that matches your wifi setup and fill in SSID and passphrase. - -## WPA/WPA2 secured -#iface wlan0-fullpageos inet manual -# wpa-ssid "put SSID here" -# wpa-psk "put password here" - -## WEP secured -#iface wlan0-fullpageos inet manual -# wireless-essid "put SSID here" -# wireless-key "put password here" - -## Open/unsecured -#iface wlan0-fullpageos inet manual -# wireless-essid "put SSID here" -# wireless-mode managed - -### WIRED CONFIGURATION ##################################################### -# The following segment allows you to configure your wired connection -# with a static IP. -# -# Just uncomment the lines prefixed with a single #. Then connect -# a cable to the Pi and another system, e.g. a Laptop, and set that -# other system's network configuration to: -# -# address: 192.168.250.10 -# netmask: 255.255.255.0 -# broadcast: 192.168.250.255 -# -# You can then reach the Pi from the system's browser by going to -# -# http://192.168.250.1 -# -# or -# -# http://fullpageos.local - -#auto eth0:1 -#iface eth0:1 inet static -# address 192.168.250.1 -# netmask 255.255.255.0 -# broadcast 192.168.250.255 - diff --git a/src/filesystem/home/root/bin/git b/src/filesystem/home/root/bin/git deleted file mode 100644 index 31f499d..0000000 --- a/src/filesystem/home/root/bin/git +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -if [ "$(id -u)" == "0" ] -then - echo "Please run git without sudo, your regular user account is enough :)" 2>&1 - exit 1 -fi - -/usr/bin/git "$@" \ No newline at end of file diff --git a/src/filesystem/home/root/bin/map_iface b/src/filesystem/home/root/bin/map_iface deleted file mode 100755 index 28aa8aa..0000000 --- a/src/filesystem/home/root/bin/map_iface +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -set -e - -IFACE=$1 - -if grep -q "^\s*iface $IFACE-fullpageos " /boot/fullpageos-network.txt -then - echo "$IFACE-fullpageos" - echo "Using /boot/fullpageos-network.txt for configuring $IFACE..." >> /var/log/map_iface.log -else - echo "$IFACE-raspbian" - echo "Using original Raspbian configuration for configuring $IFACE..." >> /var/log/map_iface.log -fi diff --git a/src/filesystem/home/root/bin/webcamd b/src/filesystem/home/root/bin/webcamd deleted file mode 100755 index fb35949..0000000 --- a/src/filesystem/home/root/bin/webcamd +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/bash - -MJPGSTREAMER_HOME=/home/pi/mjpg-streamer -MJPGSTREAMER_INPUT_USB="input_uvc.so" -MJPGSTREAMER_INPUT_RASPICAM="input_raspicam.so" - -# init configuration -camera="auto" -camera_usb_options="-r 640x480 -f 10" -camera_raspi_options="-fps 10" -additional_brokenfps_usb_devices=() - -if [ -e "/boot/octopi.txt" ]; then - source "/boot/octopi.txt" -fi - -brokenfps_usb_devices=("046d:082b" "${additional_brokenfps_usb_devices[@]}") - -# cleans up when the script receives a SIGINT or SIGTERM -function cleanup() { - # make sure that all child processed die when we die - local pids=$(jobs -pr) - [ -n "$pids" ] && kill $pids - exit 0 -} - -# says goodbye when the script shuts down -function goodbye() { - # say goodbye - echo "" - echo "Goodbye..." - echo "" -} - -# runs MJPG Streamer, using the provided input plugin + configuration -function runMjpgStreamer { - input=$1 - pushd $MJPGSTREAMER_HOME > /dev/null 2>&1 - echo Running ./mjpg_streamer -o "output_http.so -w ./www" -i "$input" - LD_LIBRARY_PATH=. ./mjpg_streamer -o "output_http.so -w ./www" -i "$input" & - wait - popd > /dev/null 2>&1 -} - -# starts up the RasPiCam -function startRaspi { - logger -s "Starting Raspberry Pi camera" - runMjpgStreamer "$MJPGSTREAMER_INPUT_RASPICAM $camera_raspi_options" -} - -# starts up the USB webcam -function startUsb { - options="$camera_usb_options" - device="video0" - - extracted_device=`echo $options | sed 's@.*-d /dev/\(video[0-9]+\).*@\1@'` - if [ "$extracted_device" != "$options" ] - then - # the camera options refer to another device, use that for determining product - device=$extracted_device - fi - - uevent_file="/sys/class/video4linux/$device/device/uevent" - if [ -e $uevent_file ]; then - # let's see what kind of webcam we have here, fetch vid and pid... - product=`cat $uevent_file | grep PRODUCT | cut -d"=" -f2` - vid=`echo $product | cut -d"/" -f1` - pid=`echo $product | cut -d"/" -f2` - vidpid=`printf "%04x:%04x" "0x$vid" "0x$pid"` - - # ... then look if it is in our list of known broken-fps-devices and if so remove - # the -f parameter from the options (if it's in there, else that's just a no-op) - for identifier in ${brokenfps_usb_devices[@]}; - do - if [ "$vidpid" = "$identifier" ]; then - echo - echo "Camera model $vidpid is known to not work with -f parameter, stripping it out" - echo - options=`echo $options | sed -e "s/\(\s\+\|^\)-f\s\+[0-9]\+//g"` - fi - done - fi - - logger -s "Starting USB webcam" - runMjpgStreamer "$MJPGSTREAMER_INPUT_USB $options" -} - -# make sure our cleanup function gets called when we receive SIGINT, SIGTERM -trap "cleanup" SIGINT SIGTERM -# say goodbye when we EXIT -trap "goodbye" EXIT - -# echo configuration -echo "Starting up webcamDaemon..." -echo "" -echo "--- Configuration: ----------------------------" -echo "camera: $camera" -echo "usb options: $camera_usb_options" -echo "raspi options: $camera_raspi_options" -echo "-----------------------------------------------" -echo "" - -# we need this to prevent the later calls to vcgencmd from blocking -# I have no idea why, but that's how it is... -vcgencmd version > /dev/null 2>&1 - -# keep mjpg streamer running if some camera is attached -while true; do - if [ -e "/dev/video0" ] && { [ "$camera" = "auto" ] || [ "$camera" = "usb" ] ; }; then - startUsb - sleep 30 & - wait - elif [ "`vcgencmd get_camera`" = "supported=1 detected=1" ] && { [ "$camera" = "auto" ] || [ "$camera" = "raspi" ] ; }; then - startRaspi - sleep 30 & - wait - else - echo "No camera detected, trying again in two minutes" - sleep 120 & - wait - fi -done diff --git a/src/fullpageos b/src/fullpageos deleted file mode 100755 index c2f0c6e..0000000 --- a/src/fullpageos +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env bash -# FullPageOS generation script -# This script takes a Raspbian image and adds to it octoprint and verions addons -# Written by Guy Sheffer -# GPL V3 - -source $FULLPAGEOS_SCRIPT_PATH/common.sh - -function execute_chroot_script() { - #move FullPageOS filesystem files - cp -vr --preserve=mode,timestamps $1/filesystem . - - #black magic of qemu-arm-static - cp `which qemu-arm-static` usr/bin - - cp $2 chroot_script - chmod 755 chroot_script - cp $FULLPAGEOS_SCRIPT_PATH/common.sh common.sh - chmod 755 common.sh - - chroot . usr/bin/qemu-arm-static /bin/bash /chroot_script - - #cleanup - rm chroot_script - rm -rfv filesystem -} - -mkdir -p $FULLPAGEOS_WORKSPACE -mkdir -p $FULLPAGEOS_MOUNT_PATH - -install_cleanup_trap -install_fail_on_error_trap $FULLPAGEOS_MOUNT_PATH -unmount_image $FULLPAGEOS_MOUNT_PATH force || true - -pushd $FULLPAGEOS_WORKSPACE - if [ -e *.img ]; then - rm *.img - fi - unzip $FULLPAGEOS_ZIP_IMG - FULLPAGEOS_IMG_PATH=`ls | grep .img` - export FULLPAGEOS_BUILDBASE=$(basename $FULLPAGEOS_IMG_PATH) - - if [ -n "$FULLPAGEOS_IMAGE_ENLARGEROOT" ] - then - # make our image a bit larger so we don't run into size problems... - enlarge_ext $FULLPAGEOS_IMG_PATH 2 $FULLPAGEOS_IMAGE_ENLARGEROOT - fi - - # mount root and boot partition - mount_image $FULLPAGEOS_IMG_PATH $FULLPAGEOS_MOUNT_PATH - if [ -n "$FULLPAGEOS_APT_CACHE" ] - then - mkdir -p "$FULLPAGEOS_APT_CACHE" - mount --bind "$FULLPAGEOS_APT_CACHE" $FULLPAGEOS_MOUNT_PATH/var/cache/apt - fi - - #Edit pi filesystem - pushd $FULLPAGEOS_MOUNT_PATH - - #make QEMU boot (remember to return) - fixLd - #sed -i 's@include /etc/ld.so.conf.d/\*.conf@\#include /etc/ld.so.conf.d/\*.conf@' etc/ld.so.conf - - # if an additional pre-script is defined, execute that now - if [ -n "$FULLPAGEOS_PRESCRIPT" ] && [ -f $FULLPAGEOS_PRESCRIPT/chroot_script ]; then - echo "Injecting environment pre script from $FULLPAGEOS_PRESCRIPT..." - execute_chroot_script $FULLPAGEOS_PRESCRIPT $FULLPAGEOS_PRESCRIPT/chroot_script - fi - - # if building a variant, execute its pre-chroot script - if [ -n "$VARIANT_BASE" ] && [ -f $VARIANT_BASE/pre_chroot_script ]; then - echo "Injecting variant pre script from $VARIANT_BASE..." - execute_chroot_script $VARIANT_BASE $VARIANT_BASE/pre_chroot_script - fi - - # execute the base chroot script - execute_chroot_script $FULLPAGEOS_SCRIPT_PATH $FULLPAGEOS_CHROOT_SCRIPT_PATH - - # if building a variant, execute its post-chroot script - if [ -n "$VARIANT_BASE" ] && [ -f $VARIANT_BASE/post_chroot_script ]; then - echo "Injecting variant post script from $VARIANT_BASE..." - execute_chroot_script $VARIANT_BASE $VARIANT_BASE/post_chroot_script - fi - - # if an additional post-script is defined, execute that now - if [ -n "$FULLPAGEOS_POSTSCRIPT" ] && [ -f $FULLPAGEOS_POSTSCRIPT/chroot_script ]; then - echo "Injecting environment post script from $FULLPAGEOS_POSTSCRIPT..." - execute_chroot_script $FULLPAGEOS_POSTSCRIPT $FULLPAGEOS_POSTSCRIPT/chroot_script - fi - - restoreLd - popd - - # unmount first boot, then root partition - unmount_image $FULLPAGEOS_MOUNT_PATH - chmod 777 $FULLPAGEOS_IMG_PATH - - if [ -n "$FULLPAGEOS_IMAGE_RESIZEROOT" ] - then - # resize image to minimal size + provided size - minimize_ext $FULLPAGEOS_IMG_PATH 2 $FULLPAGEOS_IMAGE_RESIZEROOT - fi -popd - diff --git a/src/jenkins-ci/console_parsing b/src/jenkins-ci/console_parsing deleted file mode 100644 index 7033082..0000000 --- a/src/jenkins-ci/console_parsing +++ /dev/null @@ -1,4 +0,0 @@ -error /BUILD FAILED/ -error /mv: cannot stat/ -error /md5sum: * No such file or directory/ -error /Error is not recoverable: exiting now/ diff --git a/src/modules/fullpageos/config b/src/modules/fullpageos/config new file mode 100644 index 0000000..2c23187 --- /dev/null +++ b/src/modules/fullpageos/config @@ -0,0 +1,28 @@ +############################################################################### +#override timezone, otherwise use image timezone +[ -n "$FULLPAGEOS_OVERRIDE_TIMEZONE" ] || FULLPAGEOS_OVERRIDE_TIMEZONE=default + +#override locale, otherwise use image locale +[ -n "$FULLPAGEOS_OVERRIDE_LOCALE" ] || FULLPAGEOS_OVERRIDE_LOCALE=default + +#override password, otherwise use image default +[ -n "$FULLPAGEOS_OVERRIDE_PASSWORD" ] || FULLPAGEOS_OVERRIDE_PASSWORD=default + +[ -n "$FULLPAGEOS_INCLUDE_CHROMIUM" ] || FULLPAGEOS_INCLUDE_CHROMIUM=yes +[ -n "$FULLPAGEOS_INCLUDE_LIGHTTPD" ] || FULLPAGEOS_INCLUDE_LIGHTTPD=yes + +# FullPageDashboard repo & branch +[ -n "$FULLPAGEOS_DASHBOARD_REPO_SHIP" ] || FULLPAGEOS_DASHBOARD_REPO_SHIP=https://github.com/amitdar/FullPageDashboard.git +[ -n "$FULLPAGEOS_DASHBOARD_REPO_BUILD" ] || FULLPAGEOS_DASHBOARD_REPO_BUILD= +[ -n "$FULLPAGEOS_DASHBOARD_REPO_BRANCH" ] || FULLPAGEOS_DASHBOARD_REPO_BRANCH=master +[ -n "$FULLPAGEOS_INCLUDE_DASHBOARD" ] || FULLPAGEOS_INCLUDE_DASHBOARD=yes + +# FullPageDashboard repo & branch +[ -n "$FULLPAGEOS_WELCOME_REPO_SHIP" ] || FULLPAGEOS_WELCOME_REPO_SHIP=https://github.com/tailorvj/FullPageOSWelcome.git +[ -n "$FULLPAGEOS_WELCOME_REPO_BUILD" ] || FULLPAGEOS_WELCOME_REPO_BUILD= +[ -n "$FULLPAGEOS_WELCOME_REPO_BRANCH" ] || FULLPAGEOS_WELCOME_REPO_BRANCH=master +[ -n "$FULLPAGEOS_INCLUDE_WELCOME" ] || FULLPAGEOS_INCLUDE_WELCOME=yes + +# Add GPU acceleration +[ -n "$FULLPAGEOS_INCLUDE_ACCELERATION" ] || FULLPAGEOS_INCLUDE_ACCELERATION=yes + diff --git a/src/filesystem/boot/fullpagedashboard.txt b/src/modules/fullpageos/filesystem/boot/fullpagedashboard.txt similarity index 100% rename from src/filesystem/boot/fullpagedashboard.txt rename to src/modules/fullpageos/filesystem/boot/fullpagedashboard.txt diff --git a/src/filesystem/boot/fullpageos.txt b/src/modules/fullpageos/filesystem/boot/fullpageos.txt similarity index 100% rename from src/filesystem/boot/fullpageos.txt rename to src/modules/fullpageos/filesystem/boot/fullpageos.txt diff --git a/src/filesystem/home/pi/scripts/enable_gpu b/src/modules/fullpageos/filesystem/home/pi/scripts/enable_gpu similarity index 100% rename from src/filesystem/home/pi/scripts/enable_gpu rename to src/modules/fullpageos/filesystem/home/pi/scripts/enable_gpu diff --git a/src/filesystem/home/pi/scripts/fullscreen b/src/modules/fullpageos/filesystem/home/pi/scripts/fullscreen similarity index 100% rename from src/filesystem/home/pi/scripts/fullscreen rename to src/modules/fullpageos/filesystem/home/pi/scripts/fullscreen diff --git a/src/filesystem/home/pi/scripts/refresh b/src/modules/fullpageos/filesystem/home/pi/scripts/refresh similarity index 100% rename from src/filesystem/home/pi/scripts/refresh rename to src/modules/fullpageos/filesystem/home/pi/scripts/refresh diff --git a/src/filesystem/home/pi/scripts/run_onepageos b/src/modules/fullpageos/filesystem/home/pi/scripts/run_onepageos similarity index 100% rename from src/filesystem/home/pi/scripts/run_onepageos rename to src/modules/fullpageos/filesystem/home/pi/scripts/run_onepageos diff --git a/src/filesystem/home/pi/scripts/setX11vncPass b/src/modules/fullpageos/filesystem/home/pi/scripts/setX11vncPass similarity index 100% rename from src/filesystem/home/pi/scripts/setX11vncPass rename to src/modules/fullpageos/filesystem/home/pi/scripts/setX11vncPass diff --git a/src/filesystem/home/pi/scripts/start_chromium_browser b/src/modules/fullpageos/filesystem/home/pi/scripts/start_chromium_browser similarity index 100% rename from src/filesystem/home/pi/scripts/start_chromium_browser rename to src/modules/fullpageos/filesystem/home/pi/scripts/start_chromium_browser diff --git a/src/filesystem/root/etc/fullpageos_version b/src/modules/fullpageos/filesystem/root/etc/fullpageos_version similarity index 100% rename from src/filesystem/root/etc/fullpageos_version rename to src/modules/fullpageos/filesystem/root/etc/fullpageos_version diff --git a/src/filesystem/root/usr/share/xsessions/fullpageos.desktop b/src/modules/fullpageos/filesystem/root/usr/share/xsessions/fullpageos.desktop similarity index 100% rename from src/filesystem/root/usr/share/xsessions/fullpageos.desktop rename to src/modules/fullpageos/filesystem/root/usr/share/xsessions/fullpageos.desktop diff --git a/src/filesystem/root_init/etc/systemd/system/clear_lighttpd_cache.service b/src/modules/fullpageos/filesystem/root_init/etc/systemd/system/clear_lighttpd_cache.service similarity index 100% rename from src/filesystem/root_init/etc/systemd/system/clear_lighttpd_cache.service rename to src/modules/fullpageos/filesystem/root_init/etc/systemd/system/clear_lighttpd_cache.service diff --git a/src/filesystem/root_init/etc/systemd/system/enable_gpu_first_boot.service b/src/modules/fullpageos/filesystem/root_init/etc/systemd/system/enable_gpu_first_boot.service similarity index 100% rename from src/filesystem/root_init/etc/systemd/system/enable_gpu_first_boot.service rename to src/modules/fullpageos/filesystem/root_init/etc/systemd/system/enable_gpu_first_boot.service diff --git a/src/chroot_script b/src/modules/fullpageos/start_chroot_script similarity index 82% rename from src/chroot_script rename to src/modules/fullpageos/start_chroot_script index 2c887c6..205d5f7 100755 --- a/src/chroot_script +++ b/src/modules/fullpageos/start_chroot_script @@ -9,10 +9,13 @@ set -e source /common.sh unpack /filesystem/home/pi /home/pi pi -unpack /filesystem/home/root /root root unpack /filesystem/boot /boot unpack /filesystem/root_init / +# prevent any installed services from automatically starting (I'm looking at you lighttpd) +echo exit 101 > /usr/sbin/policy-rc.d +chmod +x /usr/sbin/policy-rc.d + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5B393194 apt-get update @@ -115,29 +118,6 @@ then echo "pi:$FULLPAGEOS_OVERRIDE_PASSWORD" | chpasswd fi - -#reach pi by name -echo "$FULLPAGEOS_OVERRIDE_HOSTNAME" > /etc/hostname -sed -i -e "s@raspberrypi@$FULLPAGEOS_OVERRIDE_HOSTNAME@g" /etc/hosts - -#make sure users don't run git with sudo, thus breaking permissions, by adding /root/bin to the -#default sudo path and placing a git wrapper script there that checks if it's run as root -sed -i "s@secure_path=\"@secure_path=\"/root/bin:@g" /etc/sudoers -chmod +x /root/bin/git - -# enable raspicam -echo "# enable raspicam" >> /boot/config.txt -echo "start_x=1" >> /boot/config.txt - -# allow network configuration via /boot/fullpageos-network.txt -sed -i "s@iface wlan0 @iface wlan0-raspbian @g" /etc/network/interfaces -sed -i "s@iface wlan1 @iface wlan1-raspbian @g" /etc/network/interfaces -echo "mapping wlan0" >> /etc/network/interfaces -echo " script /root/bin/map_iface" >> /etc/network/interfaces -echo "mapping wlan1" >> /etc/network/interfaces -echo " script /root/bin/map_iface" >> /etc/network/interfaces -echo "source /boot/fullpageos-network.txt" >> /etc/network/interfaces - #unpack root in the end, so etc file are not overwritten, use root_init to unpack stuff that comes before unpack /filesystem/root / @@ -168,6 +148,8 @@ echo "exit 0" >> /etc/rc.local echo "server time.nist.gov" >> /etc/ntp.conf echo "server ntp.ubuntu.com" >> /etc/ntp.conf +rm -r /usr/sbin/policy-rc.d + #cleanup apt-get clean apt-get autoremove -y diff --git a/src/nightly_build_scripts/fullpageos_nightly_build b/src/nightly_build_scripts/fullpageos_nightly_build deleted file mode 100755 index 365ed25..0000000 --- a/src/nightly_build_scripts/fullpageos_nightly_build +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -x -whoami -FULLPAGEOSPATH=/FullPageOS - -#Update repos used -#sudo -u guy /home/guy/stuff/scripts/gitmirror/update_git_mirrors - -for i in `lsof ${FULLPAGEOSPATH}/src/workspace/mount | awk '{print $2}'`; do kill -9 $i; done - -rm ${FULLPAGEOSPATH}/src/workspace/*.img -rm ${FULLPAGEOSPATH}/src/workspace/*.zip - -pushd ${FULLPAGEOSPATH} - umount ${FULLPAGEOSPATH}/src/workspace/mount/boot - umount ${FULLPAGEOSPATH}/src/workspace/mount/dev/pts - umount ${FULLPAGEOSPATH}/src/workspace/mount - git pull origin devel - - ${FULLPAGEOSPATH}/src/build $1 - pushd src - ${FULLPAGEOSPATH}/src/release $1 - popd - chmod 777 ${FULLPAGEOSPATH}/src/* -popd diff --git a/src/release b/src/release deleted file mode 100755 index 047d3a1..0000000 --- a/src/release +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -if [ -z "$1" ];then - pushd workspace -else - pushd workspace-$1 -fi - -FILENAME=$(basename `ls . | grep .img | tail -n 1` .img) -FULLPAGEOS_FILENAME=$(echo $FILENAME-`cat ../filesystem/root/etc/fullpageos_version` | sed 's/raspbian/fullpageos/') -mv ${FILENAME}.img $FULLPAGEOS_FILENAME.img -zip $FULLPAGEOS_FILENAME.zip $FULLPAGEOS_FILENAME.img - -popd diff --git a/src/vagrant/Vagrantfile b/src/vagrant/Vagrantfile index 21123eb..a2d0438 100644 --- a/src/vagrant/Vagrantfile +++ b/src/vagrant/Vagrantfile @@ -1,16 +1,17 @@ +vagrant_root = File.dirname(__FILE__) Vagrant.configure("2") do |o| - # o.vm.box = "fullpageos-build" - #o.vm.box= "https://github.com/kraksoft/vagrant-box-ubuntu/releases/download/15.04/ubuntu-15.04-amd64.box" + # o.vm.box = "octopi-build" o.vm.box= "ubuntu/zesty64" o.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" - o.vm.synced_folder "../../", "/FullPageOS", create:true, type: "nfs" + o.vm.synced_folder File.read("../custompios_path").gsub("\n",""), "/CustomPiOS", create:true, type: "nfs" + o.vm.synced_folder "../", "/distro", create:true, type: "nfs" o.vm.network :private_network, ip: "192.168.55.55" o.vm.provision :shell, :path => "setup.sh", args: ENV['SHELL_ARGS'] + #o.vbguest.auto_update = false + o.vm.provider "virtualbox" do |v| v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] v.customize ["modifyvm", :id, "--natdnsproxy1", "on"] end - - end diff --git a/src/vagrant/run_vagrant_build.sh b/src/vagrant/run_vagrant_build.sh index 2921d96..1ef3189 100755 --- a/src/vagrant/run_vagrant_build.sh +++ b/src/vagrant/run_vagrant_build.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -sudo vagrant ssh -- -t "sudo /FullPageOS/src/nightly_build_scripts/fullpageos_nightly_build $@" +sudo vagrant ssh -- -t "sudo /CustomPiOS/nightly_build_scripts/custompios_nightly_build $@" diff --git a/src/vagrant/setup.sh b/src/vagrant/setup.sh index 409a8b1..1ae65d5 100644 --- a/src/vagrant/setup.sh +++ b/src/vagrant/setup.sh @@ -2,5 +2,3 @@ sudo apt-get update sudo apt-get install -y gawk util-linux realpath git qemu-user-static unzip zip -cd /FullPageOS/src -sudo bash ./build diff --git a/src/variants/example/config b/src/variants/example/config deleted file mode 100755 index 0f638e0..0000000 --- a/src/variants/example/config +++ /dev/null @@ -1,4 +0,0 @@ -# variant example, flavor default: override hostname & custom config setting - -OCTOPI_OVERRIDE_HOSTNAME=blueberrypi -OCTOPI_EXAMPLE_CUSTOM="Hello there" diff --git a/src/variants/example/config.nightly b/src/variants/example/config.nightly deleted file mode 100755 index 209b3bd..0000000 --- a/src/variants/example/config.nightly +++ /dev/null @@ -1,3 +0,0 @@ -# variant example, flavor nightly: override hostname & octoprint branch - -OCTOPI_OCTOPRINT_REPO_BRANCH=devel diff --git a/src/variants/example/filesystem/root/etc/dhclient.conf b/src/variants/example/filesystem/root/etc/dhclient.conf deleted file mode 100644 index e69de29..0000000 diff --git a/src/variants/example/post_chroot_script b/src/variants/example/post_chroot_script deleted file mode 100755 index da988bb..0000000 --- a/src/variants/example/post_chroot_script +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -set -x - -source /common.sh -install_chroot_fail_on_error_trap - -# install dhclient.conf and possibly other files -unpack /filesystem/root / - -#cleanup -apt-get clean From a254a76b680d73e77cdfcc53b5bd7ef248fa082b Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sat, 8 Jul 2017 02:47:42 +0300 Subject: [PATCH 02/14] Fix ighttpd_cache 'Executable path is not absolute' error --- .../root_init/etc/systemd/system/clear_lighttpd_cache.service | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/fullpageos/filesystem/root_init/etc/systemd/system/clear_lighttpd_cache.service b/src/modules/fullpageos/filesystem/root_init/etc/systemd/system/clear_lighttpd_cache.service index 1d58f3b..1552041 100644 --- a/src/modules/fullpageos/filesystem/root_init/etc/systemd/system/clear_lighttpd_cache.service +++ b/src/modules/fullpageos/filesystem/root_init/etc/systemd/system/clear_lighttpd_cache.service @@ -1,8 +1,8 @@ [Unit] Description=Clear the cache of lighttpd when the system starts [Service] -ExecStart=rm -rf /var/cache/lighttpd/* -ExecReload=rm -rf /var/cache/lighttpd/* +ExecStart=/bin/rm -rf /var/cache/lighttpd/* +ExecReload=/bin/rm -rf /var/cache/lighttpd/* ExecStop= [Install] WantedBy=multi-user.target From c68a371d6c7f3608ae48c726a5e555ee416bc40f Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sat, 8 Jul 2017 12:11:14 +0300 Subject: [PATCH 03/14] Update .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index baebd29..12f0b3e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ src/image/*.zip src/custompios_path src/build.log src/vagrant/.vagrant/* +src/vagrant/*.log +src/workspace/* From 2ea8f23cfe2880d3d004b683c45f1c8aa15e0448 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sat, 15 Jul 2017 21:08:53 +0300 Subject: [PATCH 04/14] Move gui to standard module --- src/config | 5 +-- .../filesystem/home/pi/scripts/enable_gpu | 12 ------- .../filesystem/home/pi/scripts/run_onepageos | 5 --- .../usr/share/xsessions/fullpageos.desktop | 6 ---- .../system/enable_gpu_first_boot.service | 7 ----- src/modules/fullpageos/start_chroot_script | 31 +------------------ 6 files changed, 4 insertions(+), 62 deletions(-) delete mode 100755 src/modules/fullpageos/filesystem/home/pi/scripts/enable_gpu delete mode 100644 src/modules/fullpageos/filesystem/root/usr/share/xsessions/fullpageos.desktop delete mode 100644 src/modules/fullpageos/filesystem/root_init/etc/systemd/system/enable_gpu_first_boot.service diff --git a/src/config b/src/config index 92c1078..31a4eb1 100755 --- a/src/config +++ b/src/config @@ -1,6 +1,6 @@ export DIST_NAME=FullpageOS -export DIST_VERSION=0.07 -export MODULES="base(raspicam, network, fullpageos)" +export DIST_VERSION=0.7 +export MODULES="base(raspicam, network, gui(fullpageos))" # if set will enlarge root parition prior to build by provided size in MB export BASE_IMAGE_ENLARGEROOT=1000 @@ -8,3 +8,4 @@ export BASE_IMAGE_ENLARGEROOT=1000 # if set will resize root partition on image after build to minimum size + # provided size in MB export BASE_IMAGE_RESIZEROOT=200 +export GUI_STARTUP_SCRIPT=/home/pi/scripts/run_onepageos diff --git a/src/modules/fullpageos/filesystem/home/pi/scripts/enable_gpu b/src/modules/fullpageos/filesystem/home/pi/scripts/enable_gpu deleted file mode 100755 index 7f8629a..0000000 --- a/src/modules/fullpageos/filesystem/home/pi/scripts/enable_gpu +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -if [ ! -f /etc/gpu_enabled ]; then - sudo sed 's@matchbox-window-manager \&@compton --backend glx --unredir-if-possible --glx-swap-method buffer-age --glx-no-stencil --paint-on-overlay --vsync opengl &\nmatchbox-window-manager \&@g' -i /home/pi/scripts/run_onepageos - sudo sed -i /boot/cmdline.txt -e "s/ quiet//" - sudo sed -i /boot/cmdline.txt -e "s/ splash//" - sudo sed -i /boot/cmdline.txt -e "s/ plymouth.ignore-serial-consoles//" - sudo sed -i /boot/config.txt -e "s/^\#dtoverlay=vc4-kms-v3d/dtoverlay=vc4-kms-v3d/" - sudo sed -i /boot/config.txt -e "s/^gpu_mem/\#gpu_mem/" - printf "dtoverlay=vc4-kms-v3d\n" | sudo tee -a /boot/config.txt - touch /etc/gpu_enabled - sudo shutdown -r now -fi diff --git a/src/modules/fullpageos/filesystem/home/pi/scripts/run_onepageos b/src/modules/fullpageos/filesystem/home/pi/scripts/run_onepageos index 1782305..83483ec 100755 --- a/src/modules/fullpageos/filesystem/home/pi/scripts/run_onepageos +++ b/src/modules/fullpageos/filesystem/home/pi/scripts/run_onepageos @@ -1,9 +1,4 @@ #!/bin/bash -xset s off # don't activate screensaver -xset -dpms # disable DPMS (Energy Star) features. -xset s noblank # don't blank the video device - -matchbox-window-manager & x11vnc -many -rfbauth /home/pi/.vnc/passwd & while true do diff --git a/src/modules/fullpageos/filesystem/root/usr/share/xsessions/fullpageos.desktop b/src/modules/fullpageos/filesystem/root/usr/share/xsessions/fullpageos.desktop deleted file mode 100644 index 2667a29..0000000 --- a/src/modules/fullpageos/filesystem/root/usr/share/xsessions/fullpageos.desktop +++ /dev/null @@ -1,6 +0,0 @@ -[Desktop Entry] -Version=1.0 -Name=FullPageOS -Exec=/home/pi/scripts/run_onepageos -Comment=FullPageOS startup -Type=Application \ No newline at end of file diff --git a/src/modules/fullpageos/filesystem/root_init/etc/systemd/system/enable_gpu_first_boot.service b/src/modules/fullpageos/filesystem/root_init/etc/systemd/system/enable_gpu_first_boot.service deleted file mode 100644 index 6895300..0000000 --- a/src/modules/fullpageos/filesystem/root_init/etc/systemd/system/enable_gpu_first_boot.service +++ /dev/null @@ -1,7 +0,0 @@ -[Unit] -Description=on first boot set up GPU acceleration -[Service] -ExecStart=/home/pi/scripts/enable_gpu -ExecStop= -[Install] -WantedBy=multi-user.target diff --git a/src/modules/fullpageos/start_chroot_script b/src/modules/fullpageos/start_chroot_script index 205d5f7..0956bfa 100755 --- a/src/modules/fullpageos/start_chroot_script +++ b/src/modules/fullpageos/start_chroot_script @@ -32,7 +32,7 @@ then sudo -u pi sed -i 's@%BROWSER_START_SCRIPT%@/home/pi/scripts/start_chromium_browser@g' /home/pi/scripts/run_onepageos fi -apt-get install -y --force-yes xdotool matchbox-window-manager xorg lightdm +apt-get install -y --force-yes xdotool apt-get install -y --force-yes vim x11vnc expect @@ -67,30 +67,6 @@ then fi popd - - if [ "$FULLPAGEOS_INCLUDE_ACCELERATION" == "yes" ] - then - #TODO enable_gpu - apt-get -y --force-yes install xcompmgr libgl1-mesa-dri mesa-utils compton libconfig9 - - # Hack to pass non-interactive install - mv /usr/bin/whiptail /usr/bin/whiptail.bak - echo "#!/bin/bash" > /usr/bin/whiptail - echo "exit 0" >> /usr/bin/whiptail - chmod 755 /usr/bin/whiptail - apt-get -y --force-yes install rpi-chromium-mods - rm /usr/bin/whiptail - mv /usr/bin/whiptail.bak /usr/bin/whiptail - if [ -e /usr/share/X11/xorg.conf.d/99-fbturbo.conf ]; then - mv /usr/share/X11/xorg.conf.d/99-fbturbo.conf /usr/share/X11/xorg.conf.d/99-fbturbo.~ - fi - - systemctl enable enable_gpu_first_boot.service - - else - echo "gpu_mem=128" >> /boot/config.txt - fi - echo "enabled" > /boot/check_for_httpd else echo "disabled" > /boot/check_for_httpd @@ -121,11 +97,6 @@ fi #unpack root in the end, so etc file are not overwritten, use root_init to unpack stuff that comes before unpack /filesystem/root / - -#set up gui service -sed -i 's/#user-session=.*/user-session=fullpageos/g' /etc/lightdm/lightdm.conf -sed -i 's/#autologin-user=.*/autologin-user=pi/g' /etc/lightdm/lightdm.conf - # Set up x11vnc sudo -u pi /home/pi/scripts/setX11vncPass raspberry if [ ! -f /home/pi/.vnc/passwd ]; then From cbe6eb8d368b11b878ef0b52fc15a8d0cc01133b Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Mon, 17 Jul 2017 14:51:18 +0300 Subject: [PATCH 05/14] Increment version to 0.8.0 --- src/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config b/src/config index 31a4eb1..d2daf7d 100755 --- a/src/config +++ b/src/config @@ -1,5 +1,5 @@ export DIST_NAME=FullpageOS -export DIST_VERSION=0.7 +export DIST_VERSION=0.8 export MODULES="base(raspicam, network, gui(fullpageos))" # if set will enlarge root parition prior to build by provided size in MB From cd116ada0e6b08b030b45332985168e531459167 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Wed, 19 Jul 2017 11:35:19 +0300 Subject: [PATCH 06/14] Fix build, see https://github.com/guysoft/OctoPi/issues/389 --- src/build_dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build_dist b/src/build_dist index 789cc56..428a071 100755 --- a/src/build_dist +++ b/src/build_dist @@ -5,5 +5,5 @@ export CUSTOM_PI_OS_PATH=$(<${DIR}/custompios_path) export PATH=$PATH:$CUSTOM_PI_OS_PATH echo ${CUSTOM_PI_OS_PATH} -${CUSTOM_PI_OS_PATH}/build_custom_os ${DIST_PATH} +${CUSTOM_PI_OS_PATH}/build_custom_os $@ From 9eb25b743a015edcc02ec59d06a0d5c101dba017 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Tue, 1 Aug 2017 11:38:15 +0300 Subject: [PATCH 07/14] Manual merge of #136, fixes #89 --- .../filesystem/home/pi/scripts/start_chromium_browser | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/fullpageos/filesystem/home/pi/scripts/start_chromium_browser b/src/modules/fullpageos/filesystem/home/pi/scripts/start_chromium_browser index d9209f4..1a2d814 100755 --- a/src/modules/fullpageos/filesystem/home/pi/scripts/start_chromium_browser +++ b/src/modules/fullpageos/filesystem/home/pi/scripts/start_chromium_browser @@ -1,2 +1,2 @@ #!/bin/bash -chromium-browser --kiosk --touch-events=enabled --disable-pinch --noerrdialogs --app=$(head -n 1 /boot/fullpageos.txt) +chromium-browser --kiosk --touch-events=enabled --disable-pinch --noerrdialogs --disable-session-crashed-bubble --app=$(head -n 1 /boot/fullpageos.txt) From 7fe0b99b74e62539fbe5e6b6016ac26bb15a8760 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sat, 5 Aug 2017 23:59:20 +0300 Subject: [PATCH 08/14] Fix header --- src/modules/fullpageos/start_chroot_script | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/modules/fullpageos/start_chroot_script b/src/modules/fullpageos/start_chroot_script index 0956bfa..5566a73 100755 --- a/src/modules/fullpageos/start_chroot_script +++ b/src/modules/fullpageos/start_chroot_script @@ -1,10 +1,11 @@ #!/usr/bin/env bash -set -x -set -e -# OctoPI generation script -# Helper script that runs in a Raspbian chroot to create the OctoPI distro +# FullPageOS generation script +# Helper script that runs in a Raspbian/others chroot to create the FullPageOS distro # Written by Guy Sheffer # GPL V3 +######## +set -x +set -e source /common.sh From ae95d7642a9dd6ee88dec00511b7ad866d1fe96f Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 6 Aug 2017 00:02:03 +0300 Subject: [PATCH 09/14] Use disable-services module --- src/config | 2 +- src/modules/fullpageos/start_chroot_script | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/config b/src/config index d2daf7d..baa0add 100755 --- a/src/config +++ b/src/config @@ -1,6 +1,6 @@ export DIST_NAME=FullpageOS export DIST_VERSION=0.8 -export MODULES="base(raspicam, network, gui(fullpageos))" +export MODULES="base(raspicam, network, disable-services(gui(fullpageos)))" # if set will enlarge root parition prior to build by provided size in MB export BASE_IMAGE_ENLARGEROOT=1000 diff --git a/src/modules/fullpageos/start_chroot_script b/src/modules/fullpageos/start_chroot_script index 5566a73..584e271 100755 --- a/src/modules/fullpageos/start_chroot_script +++ b/src/modules/fullpageos/start_chroot_script @@ -13,10 +13,6 @@ unpack /filesystem/home/pi /home/pi pi unpack /filesystem/boot /boot unpack /filesystem/root_init / -# prevent any installed services from automatically starting (I'm looking at you lighttpd) -echo exit 101 > /usr/sbin/policy-rc.d -chmod +x /usr/sbin/policy-rc.d - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5B393194 apt-get update @@ -112,7 +108,6 @@ fi #echo "sudo -u pi startx /home/pi/scripts/run_onepageos &" >> /etc/rc.local #echo "(sleep 15 ; sudo -u pi /home/pi/scripts/fullscreen) &" >> /etc/rc.local -echo "exit 0" >> /etc/rc.local ##################################################################### ### setup services From 197fba187bf0b227e43118da980284f543d985ba Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 6 Aug 2017 11:35:24 +0300 Subject: [PATCH 10/14] Fixes #144 --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 7e68a38..c05b01d 100644 --- a/README.rst +++ b/README.rst @@ -65,7 +65,7 @@ You can build it by issuing the following commands:: git clone https://github.com/guysoft/CustomPiOS.git git clone https://github.com/guysoft/FullPageOS.git cd FullPageOS/src/image - curl -J -O -L http://downloads.raspberrypi.org/raspbian_latest + wget -c --trust-server-names 'https://downloads.raspberrypi.org/raspbian_lite_latest' cd .. ../../CustomPiOS/src/update-custompios-paths sudo modprobe loop From 36f09cdc1a6f4aa4a7488a9ddf1e8a70843bde53 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Fri, 18 Aug 2017 21:51:07 +0300 Subject: [PATCH 11/14] Changing mirror from docstech.net to unofficialpi.org --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index c05b01d..65184c5 100644 --- a/README.rst +++ b/README.rst @@ -13,9 +13,9 @@ FullPageOS is a fork of `OctoPi `_ Where to get it? ---------------- -Official mirror is `here `_ +Official mirror is `here `_ -Nightly builds are available `here `_ (currently built on demand) +Nightly builds are available `here `_ (currently built on demand) How to use it? -------------- From 695dc3757cc6b2b9a0322b52c74ed3715cd9214b Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Thu, 24 Aug 2017 11:50:05 +0300 Subject: [PATCH 12/14] We dont download chromium from there anymore. Removed because of https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=845720 --- src/modules/fullpageos/start_chroot_script | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/modules/fullpageos/start_chroot_script b/src/modules/fullpageos/start_chroot_script index 584e271..b275a76 100755 --- a/src/modules/fullpageos/start_chroot_script +++ b/src/modules/fullpageos/start_chroot_script @@ -13,8 +13,6 @@ unpack /filesystem/home/pi /home/pi pi unpack /filesystem/boot /boot unpack /filesystem/root_init / -apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5B393194 - apt-get update apt-get remove -y --purge scratch squeak-plugins-scratch squeak-vm wolfram-engine python-minecraftpi minecraft-pi sonic-pi oracle-java8-jdk bluej greenfoot libreoffice-common libreoffice-core freepats From b23a5f08e78d686e4228acd50f66dc0ee99ac701 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Tue, 26 Sep 2017 13:57:16 +0300 Subject: [PATCH 13/14] Add virtualbox as a provider for vagrant, and vagrnat 1.9+ requirement --- README.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 65184c5..cde9e68 100644 --- a/README.rst +++ b/README.rst @@ -84,9 +84,13 @@ Building Using Vagrant ~~~~~~~~~~~~~~~~~~~~~~ There is a vagrant machine configuration to let build FullPageOS in case your build environment behaves differently. Unless you do extra configuration, vagrant must run as root to have nfs folder sync working. +Make sure you have a version of vagrant later than 1.9! + +If you are using older versions of Ubuntu/Debian and not using apt-get `from the download page `_. + To use it:: - sudo apt-get install vagrant nfs-kernel-server + sudo apt-get install vagrant nfs-kernel-server virtualbox sudo vagrant plugin install vagrant-nfs_guest sudo modprobe nfs cd FullPageOS/src/vagrant From 511176dfa4ac83f7d62fb924558b7b5c7a192a73 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sat, 14 Oct 2017 02:35:47 +0300 Subject: [PATCH 14/14] Update to work with https://github.com/guysoft/CustomPiOS/pull/8 --- README.rst | 2 +- src/vagrant/setup.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index cde9e68..1d6d63a 100644 --- a/README.rst +++ b/README.rst @@ -60,7 +60,7 @@ FullPageOS can be built from Debian, Ubuntu, Raspbian, or even FullPageOS. Build requires about 2.5 GB of free space available. You can build it by issuing the following commands:: - sudo apt-get install realpath qemu-user-static + sudo apt-get install realpath p7zip-full qemu-user-static git clone https://github.com/guysoft/CustomPiOS.git git clone https://github.com/guysoft/FullPageOS.git diff --git a/src/vagrant/setup.sh b/src/vagrant/setup.sh index 1ae65d5..71a32b0 100644 --- a/src/vagrant/setup.sh +++ b/src/vagrant/setup.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash sudo apt-get update -sudo apt-get install -y gawk util-linux realpath git qemu-user-static unzip zip +sudo apt-get install -y gawk util-linux realpath git qemu-user-static p7zip-full unzip zip