Gen 2 is go

This commit is contained in:
Fredrik Lindqvist 2017-01-30 20:52:22 +01:00
parent bc8a74858e
commit d3b956432c
26 changed files with 268 additions and 159 deletions

54
CLA.md Normal file
View File

@ -0,0 +1,54 @@
# Contributor License Agreement
The following terms are used throughout this agreement:
**You** - the person or legal entity including its affiliates asked to accept this agreement.
An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.
**Project** - is an umbrella term that refers to any and all Home Assistant open source projects.
**Contribution** - any type of work that is submitted to a Project, including any modifications or additions to existing work.
**Submitted** - conveyed to a Project via a pull request, commit, issue, or any form of electronic, written, or
verbal communication with Home Assistant, contributors or maintainers.
# 1. Grant of Copyright License.
Subject to the terms and conditions of this agreement, You grant to the Projects maintainers, contributors,
users and to Home Assistant a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce,
prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your contributions and such
derivative works. Except for this license, You reserve all rights, title, and interest in your contributions.
# 2. Grant of Patent License.
Subject to the terms and conditions of this agreement, You grant to the Projects maintainers, contributors, users and to
Home Assistant a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent
license to make, have made, use, offer to sell, sell, import, and otherwise transfer your contributions, where such license
applies only to those patent claims licensable by you that are necessarily infringed by your contribution or by combination of
your contribution with the project to which this contribution was submitted.
If any entity institutes patent litigation - including cross-claim or counterclaim in a lawsuit - against You alleging that
your contribution or any project it was submitted to constitutes or is responsible for direct or contributory patent infringement,
then any patent licenses granted to that entity under this agreement shall terminate as of the date such litigation is filed.
# 3. Source of Contribution.
Your contribution is either your original creation, based upon previous work that, to the best of your knowledge,
is covered under an appropriate open source license and you have the right under that license to submit that work with modifications,
whether created in whole or in part by you, or you have clearly identified the source of the contribution and any license or other
restriction (like related patents, trademarks, and license agreements) of which you are personally aware.
## Attribution
This Contributor License Agreement is adapted from the [GitHub CLA][github-cla].
## Signing
To sign this CLA you must first submit a pull request to a repository under the Home Assistant organization.
## Adoption
This Contributor License Agreement (CLA) was first announced on January 21st, 2017 in [this][cla-blog] blog post and adopted January 28th, 2017.
[github-cla]: https://cla.github.com/agreement
[cla-blog]: https://home-assistant.io/blog/2017/01/21/home-assistant-governance/

80
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,80 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [safety@home-assistant.io][email]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available [here][version].
## Adoption
This Code of Conduct was first adopted January 21st, 2017 and announced in [this][coc-blog] blog post.
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
[email]: mailto:safety@home-assistant.io
[coc-blog]: https://home-assistant.io/blog/2017/01/21/home-assistant-governance/

View File

@ -1,12 +1,22 @@
# pi-gen
_Tool used to create the raspberrypi.org Raspbian images_
Fork of `pi_gen` by [@RPI-Distro](https://github.com/RPi-Distro/pi-gen).
### TODO
1. Documentation
## Building your own
The Haspbian image is built with the same script that generates the official [Raspbian](https://www.raspberrypi.org/downloads/raspbian/) image's from the [Raspberry Pi Foundation](https://www.raspberrypi.org/about/).
## Dependencies
By default the Haspbian image is built on a Debian 8 droplet on Digital Ocean and takes about 30 minutes to build on the cheapest droplet. Dependencies and everything is handled by the build script with the exception of `git`.
`quilt kpartx realpath qemu-user-static debootstrap zerofree pxz zip dosfstools bsdtar libcap2-bin`
Build instructions:
- Install git. `sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install git`
- Clone the `rpi_gen` code. `git clone https://github.com/home-assistant/pi-gen.git`
- Create a file in the current folder named `config`. More about it's contense below.
- Run the build script, with sudo or as root. `sudo ./build.sh`
- Wait ~30 minutes for build to complete.
- Retrieve your freshly built Raspberry Pi image from the `rpi_gen\deploy` folder.
### Dependencies
`quilt qemu-arm-static:qemu-user-static debootstrap kpartx zerofree pxz zip mkdosfs:dosfstools capsh:libcap2-bin bsdtar`
## Config
@ -16,32 +26,18 @@ environment variables.
The following environment variables are supported:
* `IMG_NAME` **required** (Default: unset)
* `IMG_NAME`, the name of the distribution to build (required)
* `APT_PROXY`, proxy/cache URL to be included in the build
The name of the image to build with the current stage directories. Setting
`IMG_NAME=Raspbian` is logical for an unmodified RPi-Distro/pi-gen build,
but you should use something else for a customized version. Export files
in stages may add suffixes to `IMG_NAME`.
* `APT_PROXY` (Default: unset)
If you require the use of an apt proxy, set it here. This proxy setting
will not be included in the image, making it safe to use an `apt-cacher` or
similar package for development.
A simple example for building Raspbian:
A simple example for building Hassbian:
```bash
IMG_NAME='Raspbian'
IMG_NAME='Hassbian'
```
## Stage Anatomy
### Raspbian Stage Overview
The build of Raspbian is divided up into several stages for logical clarity
The build of Hassbian is divided up into several stages for logical clarity
and modularity. This causes some initial complexity, but it simplifies
maintenance and allows for more easy customization.
@ -67,7 +63,8 @@ maintenance and allows for more easy customization.
defaults, installs fake-hwclock and ntp, wifi and bluetooth support,
dphys-swapfile, and other basics for managing the hardware. It also
creates necessary groups and gives the pi user access to sudo and the
standard console hardware permission groups.
standard console hardware permission groups. This stage has a minor
modification to prevent ssh from being disabled.
There are a few tools that may not make a whole lot of sense here for
development purposes on a minimal system such as basic python and lua
@ -77,16 +74,15 @@ maintenance and allows for more easy customization.
you were looking for something between truly minimal and Raspbian-lite,
here's where you start trimming.
- **Stage 3** - desktop system. Here's where you get the full desktop system
with X11 and LXDE, web browsers, git for development, Raspbian custom UI
enhancements, etc. This is a base desktop system, with some development
tools installed.
- **Stage 3** - the HASSbian stage. This is where all the Home Assistant
specific packages are installed, permissions are set and users created.
This is the only stage we add to the original build script.
The original **Stage 3** and **Stage 4** are removed since they are not
used on the HASSbian image.
- **Stage 4** - complete Raspbian system. More development tools, an email
client, learning tools like Scratch, specialized packages like sonic-pi and
wolfram-engine, system documentation, office productivity, etc. This is
the stage that installs all of the things that make Raspbian friendly to
new users.
### Stage specification
If you wish to build up to a specified stage (such as building up to stage 2 for a lite system), place an empty file named `SKIP` in each of the `./stage` directories you wish not to include.
@ -94,7 +90,8 @@ If you wish to build up to a specified stage (such as building up to stage 2 for
Then remove the `EXPORT*` files from `./stage4` (if building up to stage 2) or from `./stage2` (if building a minimal system).
```
# Example for building a lite system
$ touch ./stage3/SKIP ./stage4/SKIP
$ rm stage4/EXPORT*
# Example for building a lite system without Home Assistant
$ touch ./stage3/SKIP
$ rm stage3/EXPORT*
```

View File

@ -1 +1 @@
raspberrypi
hassbian

View File

@ -14,7 +14,6 @@ on_chroot << EOF
systemctl disable hwclock.sh
systemctl disable nfs-common
systemctl disable rpcbind
systemctl disable ssh
systemctl enable regenerate_ssh_host_keys
systemctl enable apply_noobs_os_config
systemctl enable resize2fs_once

View File

@ -1 +0,0 @@
-lite

View File

View File

@ -1,2 +0,0 @@
# Adobe Flash Player. Copyright 1996-2015. Adobe Systems Incorporated. All Rights Reserved.
rpi-chromium-mods rpi-chromium-mods/adobe note

View File

@ -1,10 +1 @@
gstreamer1.0-x gstreamer1.0-omx gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-alsa gstreamer1.0-libav
xpdf gtk2-engines alsa-utils
desktop-base
git-core rpi-update
omxplayer
raspberrypi-artwork
policykit-1
gvfs
rfkill
chromium-browser rpi-chromium-mods
git python3 python3-venv python3-pip bluetooth libbluetooth-dev rng-tools htop tmux

View File

@ -1,6 +0,0 @@
xserver-xorg-video-fbdev xserver-xorg xinit xserver-xorg-video-fbturbo
epiphany-browser
lxde lxtask menu-xdg gksu
netsurf-gtk zenity xdg-utils
gvfs-backends gvfs-fuse
lightdm gnome-themes-standard-data gnome-icon-theme

View File

@ -1,9 +0,0 @@
#!/bin/bash -e
on_chroot << EOF
update-alternatives --install /usr/bin/x-www-browser \
x-www-browser /usr/bin/chromium-browser 86
update-alternatives --install /usr/bin/gnome-www-browser \
gnome-www-browser /usr/bin/chromium-browser 86
EOF

View File

@ -1,3 +1,26 @@
#!/bin/bash -e
rm -f ${ROOTFS_DIR}/etc/systemd/system/dhcpcd.service.d/wait.conf
on_chroot << EOF
groupadd -f -r -g 1001 homeassistant
useradd -u 1001 -g 1001 -rm homeassistant
EOF
install -v -o 1001 -g 1001 -d ${ROOTFS_DIR}/srv/homeassistant
install -m 644 files/home-assistant@homeassistant.service ${ROOTFS_DIR}/etc/systemd/system/
install -m 644 files/install_homeassistant.service ${ROOTFS_DIR}/etc/systemd/system/
wget -O files//install_homeassistant.sh https://raw.githubusercontent.com/home-assistant/hassbian-scripts/master/install_homeassistant.sh
install -m 755 files/install_homeassistant.sh ${ROOTFS_DIR}/usr/local/bin/
on_chroot << EOF
systemctl enable install_homeassistant.service
EOF
on_chroot << \EOF
for GRP in dialout gpio spi i2c video; do
adduser homeassistant $GRP
done
for GRP in homeassistant; do
adduser pi $GRP
done
EOF

View File

@ -0,0 +1,18 @@
# This is a simple service file for systems with systemd to tun HA as user.
#
# For details please check https://home-assistant.io/getting-started/autostart/
#
[Unit]
Description=Home Assistant for %i
After=network.target
[Service]
Type=simple
User=%i
ExecStart=/srv/homeassistant/bin/hass
SendSIGKILL=no
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,13 @@
# This is a simple service file for systems with systemd to tun HA as user.
#
# For details please check https://home-assistant.io/getting-started/autostart/
#
[Unit]
Description=Install Home Assistant
After=network.target
[Service]
ExecStart=/usr/local/bin/install_homeassistant.sh
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,41 @@
#!/bin/sh
echo "Home Assistant install script for Hassbian"
echo "Copyright(c) 2017 Fredrik Lindqvist <https://github.im/Landrash>"
echo "Changing to homeassistant user"
sudo -u homeassistant -H /bin/bash << EOF
echo "Creating Home Assistant venv"
python3 -m venv /srv/homeassistant
echo "Changing to Home Assistant venv"
source /srv/homeassistant/bin/activate
echo "Install latest version of Home Assistant"
pip3 install homeassistant
echo "Deactivating virtualenv"
deactivate
echo "Downloading HASSbian helper scripts"
cd /home/pi
git clone https://github.com/home-assistant/hassbian-scripts.git
EOF
echo "Enable Home Assistant service"
systemctl enable home-assistant@homeassistant.service
sync
echo "Disable and remove Home Assitant install"
systemctl disable install_homeassistant
rm /etc/systemd/system/install_homeassistant.service
rm /usr/local/bin/install_homeassistant.sh
systemctl daemon-reload
echo "Start Home Assistant"
systemctl start home-assistant@homeassistant.service
echo "Installation done. To continue have a look at "
echo "If this script failed then this Raspberry Pi most likely did not have a fully functioning internet connection."

View File

@ -1,4 +0,0 @@
# Enable realtime process priority?
jackd2 jackd/tweak_rt_limits boolean true
# Do you accept the Wolfram - Raspberry Pi® Bundle License Agreement?
wolfram-engine shared/accepted-wolfram-eula boolean true

View File

@ -1,37 +0,0 @@
java-common oracle-java8-jdk
libreoffice-sdbc-hsqldb
sonic-pi
python idle python3-pygame python-pygame python-tk
python3 idle3 python3-tk
python3-pgzero
python-serial python3-serial
python-picamera python3-picamera
debian-reference-en dillo x2x
wolfram-engine
raspberrypi-net-mods raspberrypi-ui-mods
smartsim penguinspuzzle
python-pip python3-pip
python3-numpy
pypy
python3-pifacecommon python3-pifacedigitalio python3-pifacedigital-scratch-handler python-pifacecommon python-pifacedigitalio
minecraft-pi python-minecraftpi
alacarte rc-gui sense-hat
claws-mail
tree
scratch nuscratch
greenfoot bluej
nodered
libgl1-mesa-dri libgles1-mesa libgles2-mesa xcompmgr
geany
piclone
pulseaudio-module-bluetooth
wiringpi pigpio python-pigpio python3-pigpio raspi-gpio python-gpiozero python3-gpiozero python3-rpi.gpio
python-spidev python3-spidev
realvnc-vnc-server realvnc-vnc-viewer
python-twython python3-twython
python-smbus python3-smbus
python-flask python3-flask
python-picraft python3-picraft
python3-codebug-tether python3-codebug-i2c-tether
python-sense-emu python3-sense-emu sense-emu-tools python-sense-emu-doc
pprompt

View File

@ -1,3 +0,0 @@
libreoffice libreoffice-gtk
timidity
pi-package

View File

@ -1,3 +0,0 @@
#!/bin/bash -e
rm -f "${ROOTFS_DIR}/root/.vnc/private.key"

View File

@ -1,3 +0,0 @@
#!/bin/bash -e
ln -sf /etc/systemd/system/autologin@.service ${ROOTFS_DIR}/etc/systemd/system/getty.target.wants/getty@tty1.service

View File

@ -1,33 +0,0 @@
#!/bin/bash -e
HASH=`wget https://api.github.com/repos/KenT2/python-games/git/refs/heads/master -qO -| grep \"sha\" | cut -f 2 -d ':' | cut -f 2 -d \"`
if [ -f files/python_games.hash ]; then
HASH_LOCAL=`cat files/python_games.hash`
fi
if [ ! -e files/python_games.tar.gz ] || [ "$HASH" != "$HASH_LOCAL" ]; then
wget "https://github.com/KenT2/python-games/tarball/master" -O files/python_games.tar.gz
echo $HASH > files/python_games.hash
fi
ln -sf pip3 ${ROOTFS_DIR}/usr/bin/pip-3.2
install -v -o 1000 -g 1000 -d ${ROOTFS_DIR}/home/pi/python_games
tar xvf files/python_games.tar.gz -C ${ROOTFS_DIR}/home/pi/python_games --strip-components=1
chown 1000:1000 ${ROOTFS_DIR}/home/pi/python_games -Rv
chmod +x ${ROOTFS_DIR}/home/pi/python_games/launcher.sh
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/Documents"
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/Documents/BlueJ Projects"
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/Documents/Greenfoot Projects"
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/Documents/Scratch Projects"
rsync -a --chown=1000:1000 ${ROOTFS_DIR}/usr/share/doc/BlueJ/ "${ROOTFS_DIR}/home/pi/Documents/BlueJ Projects"
rsync -a --chown=1000:1000 ${ROOTFS_DIR}/usr/share/doc/Greenfoot/ "${ROOTFS_DIR}/home/pi/Documents/Greenfoot Projects"
rsync -a --chown=1000:1000 ${ROOTFS_DIR}/usr/share/scratch/Projects/Demos/ "${ROOTFS_DIR}/home/pi/Documents/Scratch Projects"
#Alacarte fixes
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/.local"
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/.local/share"
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/.local/share/applications"
install -v -o 1000 -g 1000 -d "${ROOTFS_DIR}/home/pi/.local/share/desktop-directories"

View File

@ -1,2 +0,0 @@
python_games.hash
python_games.tar.gz

View File

View File

@ -1,4 +0,0 @@
#!/bin/bash -e
if [ ! -d ${ROOTFS_DIR} ]; then
copy_previous
fi