diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..0bd8fd4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,17 @@ +#### What were you doing? + +[Please be as specific as possible here] + +#### What did you expect to happen? + +#### What happened instead? + +#### Was there an error message displayed? What did it say? + +#### Version of FullPageOS? + +[Can be found in /etc/fullpageos_version ALWAYS INCLUDE.] + +#### Screenshot(s) showing the problem: + +[If applicable. Always include if unsure or reporting UI issues.] diff --git a/README.rst b/README.rst index 26c9bf4..ff65230 100644 --- a/README.rst +++ b/README.rst @@ -25,6 +25,12 @@ How to use it? #. Boot the Pi from the SD card #. Log into your Pi via SSH (it is located at ``fullpageos.local`` `if your computer supports bonjour `_ or the IP address assigned by your router), default username is "pi", default password is "raspberry", change the password using the ``passwd`` command and expand the filesystem of the SD card through the corresponding option when running ``sudo raspi-config``. +Requirements +------------ +* Raspberrypi 2 and newser or device running Armbian, Older Rasperry Pis are not currently supported. See `Raspberry Pi `_ and `Raspberry Pi `_. +* 2A power supply + + Features -------- @@ -87,6 +93,11 @@ After provisioning the machine, its also possible to run a nightly build which u cd FullPageOS/src/vagrant run_vagrant_build.sh + +To build a variant on the machine simply run:: + + cd FullPageOS/src/vagrant + run_vagrant_build.sh [Variant] Usage ~~~~~ diff --git a/src/chroot_script b/src/chroot_script index 5e5f6d9..73c0e53 100755 --- a/src/chroot_script +++ b/src/chroot_script @@ -23,31 +23,98 @@ apt-get autoremove -y #apt-get tools apt-get -y --force-yes install python2.7 git screen checkinstall avahi-daemon libavahi-compat-libdnssd1 xterm -apt-get install -y --force-yes chromium-browser xdotool matchbox-window-manager xorg lightdm +if [ "$FULLPAGEOS_INCLUDE_CHROMIUM" == "yes" ] +then + apt-get install -y --force-yes chromium-browser + 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 vim x11vnc expect + #Install web stack -apt-get install -y lighttpd php5-common php5-cgi php5 -lighty-enable-mod fastcgi-php -#service lighttpd force-reload -chown -R www-data:www-data /var/www/html -chmod 775 /var/www/html -usermod -a -G www-data pi -systemctl enable clear_lighttpd_cache.service -pushd /var/www/html - #Put git clones in place - gitclone FULLPAGEOS_DASHBOARD_REPO FullPageDashboard - gitclone FULLPAGEOS_WELCOME_REPO welcome - chown -R pi:pi FullPageDashboard - chown -R www-data:www-data FullPageDashboard - chmod 775 FullPageDashboard - pushd FullPageDashboard - sed -i "s@'INIT_URL_PATH', __DIR__ . '/init.txt'@'INIT_URL_PATH', '/boot/fullpagedashboard.txt'@g" config.php +if [ "$FULLPAGEOS_INCLUDE_LIGHTTPD" == "yes" ] +then + apt-get install -y lighttpd php5-common php5-cgi php5 + lighty-enable-mod fastcgi-php + #service lighttpd force-reload + chown -R www-data:www-data /var/www/html + chmod 775 /var/www/html + usermod -a -G www-data pi + systemctl enable clear_lighttpd_cache.service + systemctl enable ssh.socket + pushd /var/www/html + #Put git clones in place + if [ "$FULLPAGEOS_INCLUDE_DASHBOARD" == "yes" ] + then + gitclone FULLPAGEOS_DASHBOARD_REPO FullPageDashboard + chown -R pi:pi FullPageDashboard + chown -R www-data:www-data FullPageDashboard + chmod 775 FullPageDashboard + pushd FullPageDashboard + sed -i "s@'INIT_URL_PATH', __DIR__ . '/init.txt'@'INIT_URL_PATH', '/boot/fullpagedashboard.txt'@g" config.php + popd + fi + #Set Welcome screen + if [ "$FULLPAGEOS_INCLUDE_WELCOME" == "yes" ] + then + gitclone FULLPAGEOS_WELCOME_REPO welcome + chown -R www-data:www-data welcome + fi popd - #Set Welcome screen - chown -R www-data:www-data welcome -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 +fi + + +#override timezone +if [ "$FULLPAGEOS_OVERRIDE_TIMEZONE" != "default" ] +then + echo "$FULLPAGEOS_OVERRIDE_TIMEZONE" > /etc/timezone + dpkg-reconfigure -f noninteractive tzdata +fi + +#override locale +if [ "$FULLPAGEOS_OVERRIDE_LOCALE" != "default" ] +then + sed -i '/^#.* '"$FULLPAGEOS_OVERRIDE_LOCALE"' /s/^# //' /etc/locale.gen + locale-gen + update-locale LANG="$FULLPAGEOS_OVERRIDE_LOCALE" +fi + +#override password +if [ "$FULLPAGEOS_OVERRIDE_PASSWORD" != "default" ] +then + echo "pi:$FULLPAGEOS_OVERRIDE_PASSWORD" | chpasswd +fi + #reach pi by name echo "$FULLPAGEOS_OVERRIDE_HOSTNAME" > /etc/hostname @@ -61,7 +128,6 @@ chmod +x /root/bin/git # enable raspicam echo "# enable raspicam" >> /boot/config.txt echo "start_x=1" >> /boot/config.txt -echo "gpu_mem=128" >> /boot/config.txt # allow network configuration via /boot/fullpageos-network.txt sed -i "s@iface wlan0 @iface wlan0-raspbian @g" /etc/network/interfaces diff --git a/src/common.sh b/src/common.sh index 581fe8f..f6d30a1 100755 --- a/src/common.sh +++ b/src/common.sh @@ -125,7 +125,7 @@ function mount_image() { # mount root and boot partition sudo mount -o loop,offset=$root_offset $image_path $mount_path/ - sudo mount -o loop,offset=$boot_offset $image_path $mount_path/boot + 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 } diff --git a/src/config b/src/config index 9d311dd..85cb45b 100755 --- a/src/config +++ b/src/config @@ -54,6 +54,17 @@ fi [ -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 @@ -67,6 +78,10 @@ fi [ -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. diff --git a/src/filesystem/home/pi/.octoprint/config.yaml b/src/filesystem/home/pi/.octoprint/config.yaml deleted file mode 100644 index 51daab5..0000000 --- a/src/filesystem/home/pi/.octoprint/config.yaml +++ /dev/null @@ -1,35 +0,0 @@ -webcam: - stream: /webcam/?action=stream - snapshot: http://127.0.0.1:8080/?action=snapshot - ffmpeg: /usr/bin/avconv -plugins: - cura: - cura_engine: /usr/local/bin/cura_engine - discovery: - publicPort: 80 - softwareupdate: - checks: - octoprint: - update_folder: /home/pi/OctoPrint - octoprint_restart_command: sudo service octoprint restart - environment_restart_command: sudo shutdown -r now -system: - actions: - - name: Shutdown - command: sudo shutdown -h now - action: shutdown - confirm: You are about to shutdown the system. - async: true - ignore: true - - name: Reboot - command: sudo shutdown -r now - action: reboot - confirm: You are about to reboot the system - async: true - ignore: true - - name: Restart OctoPrint - command: sudo service octoprint restart - action: restart - confirm: You are about to restart OctoPrint - async: true - ignore: true diff --git a/src/filesystem/home/pi/scripts/enable_gpu b/src/filesystem/home/pi/scripts/enable_gpu new file mode 100755 index 0000000..7f8629a --- /dev/null +++ b/src/filesystem/home/pi/scripts/enable_gpu @@ -0,0 +1,12 @@ +#!/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/filesystem/home/pi/scripts/run_onepageos b/src/filesystem/home/pi/scripts/run_onepageos index 84c8c86..1782305 100755 --- a/src/filesystem/home/pi/scripts/run_onepageos +++ b/src/filesystem/home/pi/scripts/run_onepageos @@ -7,10 +7,10 @@ matchbox-window-manager & x11vnc -many -rfbauth /home/pi/.vnc/passwd & while true do - if [ $(curl -sL -w "%{http_code}\\n" "http://localhost/FullPageDashboard" -o /dev/null) == "200" ]; then + if [ $(curl -sL -w "%{http_code}\\n" "http://localhost/FullPageDashboard" -o /dev/null) == "200" ] || grep -q disabled "/boot/check_for_httpd" ; then (sleep 15 ; /home/pi/scripts/fullscreen) & xdotool mousemove 9000 9000 - chromium-browser --kiosk --app=$(head -n 1 /boot/fullpageos.txt) + %BROWSER_START_SCRIPT% fi sleep 1 done diff --git a/src/filesystem/home/pi/scripts/start_chromium_browser b/src/filesystem/home/pi/scripts/start_chromium_browser new file mode 100755 index 0000000..d9209f4 --- /dev/null +++ b/src/filesystem/home/pi/scripts/start_chromium_browser @@ -0,0 +1,2 @@ +#!/bin/bash +chromium-browser --kiosk --touch-events=enabled --disable-pinch --noerrdialogs --app=$(head -n 1 /boot/fullpageos.txt) diff --git a/src/filesystem/root/etc/fullpageos_version b/src/filesystem/root/etc/fullpageos_version index a918a2a..faef31a 100644 --- a/src/filesystem/root/etc/fullpageos_version +++ b/src/filesystem/root/etc/fullpageos_version @@ -1 +1 @@ -0.6.0 +0.7.0 diff --git a/src/filesystem/root_init/etc/apt/sources.list.d/chromium-browser.list b/src/filesystem/root_init/etc/apt/sources.list.d/chromium-browser.list deleted file mode 100644 index 2c6f350..0000000 --- a/src/filesystem/root_init/etc/apt/sources.list.d/chromium-browser.list +++ /dev/null @@ -1 +0,0 @@ -deb http://ppa.launchpad.net/canonical-chromium-builds/stage/ubuntu vivid main diff --git a/src/filesystem/root_init/etc/systemd/system/enable_gpu_first_boot.service b/src/filesystem/root_init/etc/systemd/system/enable_gpu_first_boot.service new file mode 100644 index 0000000..6895300 --- /dev/null +++ b/src/filesystem/root_init/etc/systemd/system/enable_gpu_first_boot.service @@ -0,0 +1,7 @@ +[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/vagrant/Vagrantfile b/src/vagrant/Vagrantfile index c880617..21123eb 100644 --- a/src/vagrant/Vagrantfile +++ b/src/vagrant/Vagrantfile @@ -1,9 +1,16 @@ 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= "https://github.com/kraksoft/vagrant-box-ubuntu/releases/download/15.04/ubuntu-15.04-amd64.box" + 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.network :private_network, ip: "192.168.55.55" o.vm.provision :shell, :path => "setup.sh", args: ENV['SHELL_ARGS'] + o.vm.provider "virtualbox" do |v| + v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] + v.customize ["modifyvm", :id, "--natdnsproxy1", "on"] + end + + end