Giter Site home page Giter Site logo

guilhermgonzaga / pi-init2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from richardbronosky/pi-init2

0.0 0.0 0.0 1.47 MB

Set up a Raspberry Pi and manage any of its configuration just from the /boot partition

License: MIT License

Shell 27.91% Go 64.85% Makefile 7.24%

pi-init2's Introduction

Raspberry Pi Pre Init

Purpose

A program which lets you set up a Raspberry Pi solely by writing to the /boot partition (i.e. the one you can write from most computers!).

This allows you to distribute a small .zip file to set up a Raspberry Pi to do anything. You tell the user to unzip it over the top of the Pi's boot partition - the system can set itself up perfectly on the first boot.

This package contains a single run-once.sh script that can be used to do all the setup needed. Alternatively, you can create a run-once.d and/or a on-boot.d directory and put multiple scripts in either/each. These folders will be created for you after the first boot and can be used at any time.

Trying it out

  • Download and write a standard Raspbian SD card, e.g. the Raspbian Stretch Lite.
  • Copy the content of this project's boot folder to the microSD card's /boot partition.
  • Rename either cmdline.txt.stretch or cmdline.txt.jessie to cmdline.txt.orig (this selection will be automatic in a later update)
  • Remove the SD card and put it into your Pi.

The Raspberry Pi should now boot several times. The first boot takes 2-5 minutes depending on your network, and which model of Raspberry Pi you use (I tested with model 3).

By default only a single simple change will be applied. A /home/pi/.bash_aliases file will be created with alias ll='ls -la in it. The boot/run-once.sh script includes several commented blocks to demonstrate how to accomplish common tasks.

Building pi-init2

You will need golang installed (I'm currently using 1.7) sudo apt install golang. Go will need to install required packages. I have tried to make this as easy as calling make reqs.

There is a Makefile in the root of this project. Calling make will compile the Go source code and create boot/pi-init2 if it doesn't exist. (Use make clean all to replace it.)

How it works

This is really cool. The cmdline.txt specifies an init=/pi-init2 kernel argument to use a custom binary in this package in place of the usual systemd init. That binary holds everything except for the cmdline.txt file (that would be a chicken-egg problem) and the run-once.sh which you will modify to script your desired setup.

How/Why you should incorporate this project into your Raspberry Pi project

If you have a project you expect someone to run on an RPi (especially if it would be the RPi's single purpose) you could provide your own run-once.sh script that will clone your project, configure, and install it.

Disclaimer/Credits

This has been tested with this (what I believe to be the latest release) version of Jessie but the instructions above assume Stretch.

Credits go to the following projects:

  • pi-init2: This is the fork of this project that I chose to base my fork off of.
  • raspbian-boot-setup: My first project attempting to accomplish the same goal.
  • PiBakery: A good resource to find more blocks to setup your Raspberry Pi.

Any contributions appreciated!

pi-init2's People

Contributors

cdn avatar gesellix avatar ivuk avatar richardbronosky avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.