├── Examples ├── README.md └── Raspbian │ ├── AutoMountDataPartition │ ├── AutoMountDataPartition │ ├── README.md │ └── Raspbian_root.txt │ ├── direct-network │ ├── README.md │ ├── Raspbian_boot.txt │ └── direct │ │ ├── cmdline.txt │ │ └── network │ │ ├── README.txt │ │ ├── WINsetDirect.bat │ │ ├── WINsetICS.bat │ │ ├── WINsetNORM.bat │ │ ├── cmdline.direct │ │ ├── cmdline.internet │ │ ├── cmdline.normal │ │ ├── cmdline.txt │ │ └── switchip.sh │ ├── nc-helpers │ ├── README.md │ ├── Raspbian_root.txt │ └── nc-helpers.tar │ └── wifi │ ├── README.md │ ├── Raspbian_root.txt │ └── wifi │ ├── interfaces │ └── wpa_supplicant.conf ├── Helpers ├── README.md ├── nc-capture-wifi ├── nc-create-custom-tar ├── nc-create-custom-xz ├── nc-get-label └── nc-set-wifi ├── README.md ├── dev ├── customise.sh ├── os │ ├── Arch │ │ └── partition_setup.sh │ ├── OpenELEC │ │ └── partition_setup.sh │ ├── Pidora │ │ └── partition_setup.sh │ ├── RaspBMC │ │ └── partition_setup.sh │ ├── Raspbian │ │ └── partition_setup.sh │ └── data_partition │ │ └── partition_setup.sh └── retro.sh ├── noobsconfig.zip └── zeroconf_wifi.md /Examples/README.md: -------------------------------------------------------------------------------- 1 | Noobsconfig - Examples 2 | ====================== 3 | The folders below here contain a few examples of how noobsconfig can be used to customise a distro during installation with NOOBS, grouped into distro folders. 4 | 5 | The current examples focus on Raspbian, but I welcome other examples, particularly for the other distros. 6 | 7 | After unzipping the noobsconfig.zip file over your noobs files, copy the examples files you want to use into the appropriate /os/distro folder in noobs according to the individual README.md files. If you want to use several customisations at once, you must merge the Raspbian_root.txt (or Raspbian_boot.txt) files together. 8 | -------------------------------------------------------------------------------- /Examples/Raspbian/AutoMountDataPartition/AutoMountDataPartition: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #USAGE: AutoMountDataPartition 4 | 5 | #Mounts the noobs Data_Partition at the folder location given by the first argument. 6 | #If no argument is given, it mounts the data partition at /mnt/DATA 7 | 8 | set -x 9 | 10 | #The partition filesystem is assumed to be ext4. If you want to use a different file system, 11 | #specify the type as the second argument. e.g. 'vfat' or 'auto'. 12 | 13 | #Create a temporary mount point for the noobs settings partition 14 | tmpdir=`sudo mktemp -d /media/settingXXX` 15 | #Mount the NOOBS setting partition 16 | sudo mount /dev/mmcblk0p3 $tmpdir 17 | 18 | #Identify the mountpoint 19 | if [ "$1" ]; then 20 | export MountPoint="$1" 21 | else 22 | export MountPoint="/mnt/DATA" 23 | fi 24 | 25 | #Identify the filesystem 26 | if [ "$2" ]; then 27 | export MyFsType="$2" 28 | else 29 | export MyFsType="ext4" 30 | fi 31 | 32 | #Identify the partition of the Data_Partition 33 | while read line 34 | do 35 | #complicated expression to extract the partition name from installed_os.json 36 | name=`echo $line | sed -n "s/\"name\".*:.*\"\(.*\)\".*/\1\r\n/p" | sed "s/ \+/_/g" | tr -d '\r'` 37 | if [ "$name" ]; then 38 | partname=$name 39 | fi 40 | #Extract any line with 'partitions' in it 41 | name=`echo $line | sed -n "s/\"partitions\"/partitions/p"` 42 | if [ "$name" ]; then 43 | read line 44 | if [ "$partname" = "Data_Partition" ]; then 45 | #Get the 1st partition of the Data_Partition 46 | export data_part=`echo $line | sed -n "s/\"\(.*\)\"/\1/p"` 47 | fi 48 | read line 49 | fi 50 | done <$tmpdir/installed_os.json 51 | 52 | #Remove the SETTINGS mount 53 | sudo umount $tmpdir 54 | sudo rmdir $tmpdir 55 | 56 | #Mount the Data_Partition 57 | if [ "$data_part" ]; then 58 | sudo sh -c "echo '$data_part $MountPoint $MyFsType defaults 0 0'>>/etc/fstab" 59 | sudo mkdir -p "$MountPoint" 60 | sudo mount "$data_part" "$MountPoint" -t "$MyFsType" 61 | fi 62 | 63 | unset data_part 64 | unset MountPoint 65 | unset MyFsType 66 | -------------------------------------------------------------------------------- /Examples/Raspbian/AutoMountDataPartition/README.md: -------------------------------------------------------------------------------- 1 | NOOBSConfig - AutoMountDataPartition script 2 | =========================================== 3 | This example provides a script that can be used to mount the additional Data_Partition created by NOOBS into Raspbian. 4 | 5 | Copying the files in this folder into the /os/Raspbian folder on your NOOBS recovery partition will install the AutoMountDataPartition script into the /home/pi folder of Raspbian. 6 | 7 | Exceute `./AutoMountDataPartition ` in Raspbian to mount the Data_Partition to ``. If `` is not given, it will mount the Data_Partition to `/mnt/DATA` by default. You can optionally specify the filesystem type of the data partion as the 2nd argument. If none is given, it is assumed to be `ext4`. 8 | 9 | The mount is made permanent by updating /etc/fstab, so this script need only be executed once. 10 | -------------------------------------------------------------------------------- /Examples/Raspbian/AutoMountDataPartition/Raspbian_root.txt: -------------------------------------------------------------------------------- 1 | #file destinationFolder Attributes user group 2 | AutoMountDataPartition /home/pi +x -------------------------------------------------------------------------------- /Examples/Raspbian/direct-network/README.md: -------------------------------------------------------------------------------- 1 | Noobsconfig - Direct Network Connection 2 | ======================================= 3 | Meltwater provides some excellent guides (http://pihw.wordpress.com/guides/direct-network-connection/super-easy-direct-network-connection/ and http://pihw.wordpress.com/guides/direct-network-connection/) on how to set up a direct wired connection to your RPi from a laptop or PC when you don't have a full network and no DHCP sever to provide IP addresses. 4 | 5 | But at the time of writing, this was only possible if you installed a pure Raspbian image. NOOBS users had a problem since the Raspbian image was contained in a compressed tar file, so it was not easy to access the `cmdline.txt` file. 6 | 7 | Noobsconfig provides as answer to this as it makes it possible to replace the `cmdline.txt` after the boot image has been written to the SD card. 8 | 9 | Copying the files in this folder and below into the /os/Raspbian folder on your NOOBS recovery partition will give the RPi an IP address of 169.254.0.10 10 | when you next boot into Raspbian after it is installed. If you want to use a different IP address, just edit the cmdline.txt file in the `direct` folder. 11 | 12 | In addition, the `network` folder contains Meltwater's original scripts. With these files copied onto the NOOBS recovery partition, you can edit the cmdline files in Windows to select the IP addresses you want to use for the different network modes: direct, internet or ICS. Still in Windows, you can execute the various WIN*.bat files to select which connection mode you want to use. 13 | 14 | Noobsconfig will install the cmdline files and switchip.sh into the /boot/network folder of the installed Raspbian distro. So, after Raspbian is installed, you can use the /boot/network/switchip.sh script to change between the different connection modes on the RPi. Please see Meltwater's comprehensive guides for more detail. -------------------------------------------------------------------------------- /Examples/Raspbian/direct-network/Raspbian_boot.txt: -------------------------------------------------------------------------------- 1 | direct/cmdline.txt 2 | direct/network/cmdline.direct /network 3 | direct/network/cmdline.internet /network 4 | direct/network/cmdline.normal /network 5 | direct/network/cmdline.txt /network 6 | direct/network/README.txt /network 7 | direct/network/switchip.sh /network 0644 8 | -------------------------------------------------------------------------------- /Examples/Raspbian/direct-network/direct/cmdline.txt: -------------------------------------------------------------------------------- 1 | dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait ip=169.254.0.10 2 | -------------------------------------------------------------------------------- /Examples/Raspbian/direct-network/direct/network/README.txt: -------------------------------------------------------------------------------- 1 | -------Version 1.0 June2013 2 | -------Created by Tim Cox (meltwater) 3 | -------www.pihardware.com 4 | -------Free to use - must include above details. 5 | -------Modified by ProCount for use with noobsconfig 6 | 7 | The files must be extracted to the Raspberry Pi's SD-Card. 8 | In windows, you should have a single folder on the SD-Card called "network" which will contian the files. 9 | 10 | On the Raspberry Pi, the files should be located at "/boot/network". 11 | 12 | Default direct IP address is 169.254.0.10 13 | 14 | Ensure you update the cmdline.internet file if you intend to use this. -------------------------------------------------------------------------------- /Examples/Raspbian/direct-network/direct/network/WINsetDirect.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | @setlocal enableextensions 3 | @cd /d "%~dp0" 4 | REM -------Version 1.0 June2013 5 | REM -------Created by Tim Cox (meltwater) 6 | REM -------www.pihardware.com 7 | REM -------Free to use - must include above details. 8 | set SOURCE=cmdline.direct 9 | set TARGET=cmdline.txt 10 | set DESC=direct (PC to RPi) 11 | set INFO1=# Ensure the PC's network adaptor is set to auto/DHCP 12 | set INFO2=# and internet connection sharing (ICS) is disabled. 13 | set INFO3= 14 | set IP1=# See below, ip=x.x.x.x will be the new address of the RPi 15 | 16 | echo.### Setting Raspberry Pi network to %DESC% ### 17 | echo. 18 | echo.%INFO1% 19 | echo.%INFO2% 20 | echo.%INFO3% 21 | echo. 22 | echo.# Copy %SOURCE% to %TARGET% 23 | copy %SOURCE% ..\%TARGET% 24 | echo. 25 | echo.%IP1% 26 | echo.%IP2% 27 | echo.# Contents of cmdline.txt: 28 | type ..\cmdline.txt 29 | echo. 30 | pause -------------------------------------------------------------------------------- /Examples/Raspbian/direct-network/direct/network/WINsetICS.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | @setlocal enableextensions 3 | @cd /d "%~dp0" 4 | REM -------Version 1.0 June2013 5 | REM -------Created by Tim Cox (meltwater) 6 | REM -------www.pihardware.com 7 | REM -------Free to use - must include above details. 8 | set SOURCE=cmdline.internet 9 | set TARGET=cmdline.txt 10 | set DESC=direct with ICS (PC to RPi) 11 | set INFO1=# MAKE SURE YOU UPDATE THE IP ADDRESSES IN cmdline.internet 12 | set INFO2=# ip=A.B.C.10::A.B.C.D (where ABCD match the PC's 13 | set INFO3=# network adaptor settings (AFTER ICS is enabled). 14 | set IP1=# See new settings below for IP address ip=x.x.x.x::y.y.y.y 15 | set IP2=# (where x is RPi and y is PC address) 16 | 17 | echo.### Setting Raspberry Pi network to %DESC% ### 18 | echo. 19 | echo.%INFO1% 20 | echo.%INFO2% 21 | echo.%INFO3% 22 | echo. 23 | echo.# Copy %SOURCE% to %TARGET% 24 | copy %SOURCE% ..\%TARGET% 25 | echo. 26 | echo.%IP1% 27 | echo.%IP2% 28 | echo.# Contents of cmdline.txt: 29 | type ..\cmdline.txt 30 | echo. 31 | pause -------------------------------------------------------------------------------- /Examples/Raspbian/direct-network/direct/network/WINsetNORM.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | @setlocal enableextensions 3 | @cd /d "%~dp0" 4 | REM -------Version 1.0 June2013 5 | REM -------Created by Tim Cox (meltwater) 6 | REM -------www.pihardware.com 7 | REM -------Free to use - must include above details. 8 | set SOURCE=cmdline.normal 9 | set TARGET=cmdline.txt 10 | set DESC=automatic DHCP 11 | set INFO1=# Connect RPi to DHCP enabled router or similar 12 | set INFO2= 13 | set INFO3= 14 | set IP1=# Use hostname -I on RPi to find IP address allocated 15 | set IP2= 16 | 17 | echo.### Setting Raspberry Pi network to %DESC% ### 18 | echo. 19 | echo.%INFO1% 20 | echo.%INFO2% 21 | echo.%INFO3% 22 | echo. 23 | echo.# Copy %SOURCE% to %TARGET% 24 | copy %SOURCE% ..\%TARGET% 25 | echo. 26 | echo.%IP1% 27 | echo.%IP2% 28 | echo.# Contents of cmdline.txt: 29 | type ..\cmdline.txt 30 | echo. 31 | pause -------------------------------------------------------------------------------- /Examples/Raspbian/direct-network/direct/network/cmdline.direct: -------------------------------------------------------------------------------- 1 | dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait ip=169.254.0.10 2 | -------------------------------------------------------------------------------- /Examples/Raspbian/direct-network/direct/network/cmdline.internet: -------------------------------------------------------------------------------- 1 | dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait ip=192.168.137.10::192.168.137.1 2 | -------------------------------------------------------------------------------- /Examples/Raspbian/direct-network/direct/network/cmdline.normal: -------------------------------------------------------------------------------- 1 | dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait 2 | -------------------------------------------------------------------------------- /Examples/Raspbian/direct-network/direct/network/cmdline.txt: -------------------------------------------------------------------------------- 1 | dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait -------------------------------------------------------------------------------- /Examples/Raspbian/direct-network/direct/network/switchip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #Function to swap to Direct IP Address 4 | direct () { sudo cp /boot/network/cmdline.direct /boot/cmdline.txt;} 5 | 6 | #Function to swap to Normal Automatic IP Address 7 | normal () { sudo cp /boot/network/cmdline.normal /boot/cmdline.txt;} 8 | 9 | #Function to swap to Internet IP Address 10 | internet () { sudo cp /boot/network/cmdline.internet /boot/cmdline.txt;} 11 | 12 | # Menu using case-esac 13 | echo "Select IP Address? Use: Direct / ICS / Auto / Keep (d/i/a/k)?" 14 | read answer 15 | case $answer in 16 | d|D) echo "Use Direct IP;direct";; 17 | i|I) echo "Use Internet (ICS) Direct IP";internet;; 18 | a|A) echo "Use Auto IP (normal LAN)";normal;; 19 | *) echo "Keep - No Change";; 20 | esac 21 | 22 | echo cmdline.txt 23 | echo ____________ 24 | cat /boot/cmdline.txt 25 | -------------------------------------------------------------------------------- /Examples/Raspbian/nc-helpers/README.md: -------------------------------------------------------------------------------- 1 | NOOBSConfig - helper scripts 2 | ============================ 3 | This example provides a TAR file containing the helper scripts located and described in the Helpers folder. 4 | 5 | Copying the files in this folder into the /os/Raspbian folder on your NOOBS recovery partition will install the helper scripts into the /usr/local/bin folder of your Raspbian installation, so that they can be used to help make other custom tarballs. 6 | -------------------------------------------------------------------------------- /Examples/Raspbian/nc-helpers/Raspbian_root.txt: -------------------------------------------------------------------------------- 1 | nc-helpers.tar 2 | -------------------------------------------------------------------------------- /Examples/Raspbian/nc-helpers/nc-helpers.tar: -------------------------------------------------------------------------------- 1 | nc-capture-wifi0000755000000000000620000000043112314410406012620 0ustar rootstaff#!/bin/sh 2 | 3 | if [ -z $1 ]; then 4 | #Create a custom file name from the flavour and partition names 5 | partLabel=$(nc-get-label) 6 | else 7 | #Use the given name 8 | partLabel=$1 9 | fi 10 | 11 | echo "/etc/network/interfaces">>$partLabel 12 | echo "/etc/wpa_supplicant/wpa_supplicant.conf">>$partLabel 13 | 14 | nc-create-custom-tar0000755000000000000620000000014012314410406013555 0ustar rootstafflabel=$1 15 | if [ -z "$label" ];then 16 | label=$(nc-get-label) 17 | fi 18 | 19 | sudo tar cvf $label.tar -T $label 20 | nc-create-custom-xz0000755000000000000620000000016312314410406013435 0ustar rootstafflabel=$1 21 | if [ -z "$label" ];then 22 | label=$(nc-get-label) 23 | fi 24 | 25 | sudo tar cvf $label.tar -T $label 26 | sudo xz $label.tar 27 | nc-get-label0000755000000000000620000000147412263131704012071 0ustar rootstaff#!/bin/sh 28 | 29 | #set -x 30 | 31 | #Get the location of the OS images 32 | imagefolder=`sed -n "s/.*\"imagefolder\".*:.*\"\(.*\)\".*/\1/p" tmp/etc/wpa_supplicant/wpa_supplicant.conf<tmp/etc/network/interfaces<tmp/$fname<>$partLabel 12 | echo "/etc/wpa_supplicant/wpa_supplicant.conf">>$partLabel 13 | 14 | -------------------------------------------------------------------------------- /Helpers/nc-create-custom-tar: -------------------------------------------------------------------------------- 1 | label=$1 2 | if [ -z "$label" ];then 3 | label=$(nc-get-label) 4 | fi 5 | 6 | sudo tar cvf $label.tar -T $label 7 | -------------------------------------------------------------------------------- /Helpers/nc-create-custom-xz: -------------------------------------------------------------------------------- 1 | label=$1 2 | if [ -z "$label" ];then 3 | label=$(nc-get-label) 4 | fi 5 | 6 | sudo tar cvf $label.tar -T $label 7 | sudo xz $label.tar 8 | -------------------------------------------------------------------------------- /Helpers/nc-get-label: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #set -x 4 | 5 | #Get the location of the OS images 6 | imagefolder=`sed -n "s/.*\"imagefolder\".*:.*\"\(.*\)\".*/\1/p" tmp/etc/wpa_supplicant/wpa_supplicant.conf<tmp/etc/network/interfaces<tmp/$fname< 87 | Arch_boot 88 | Arch_root 89 | Data_Partition_data 90 | OpenELEC_Storage 91 | OpenELEC_System 92 | Pidora_boot 93 | Pidora_rootfs 94 | Raspbian_boot 95 | Raspbian_root 96 | Raspbian_-_Boot_to_Scratch_boot 97 | Raspbian_-_Boot_to_Scratch_root 98 | RaspBMC_boot 99 | RaspBMC_root 100 | 101 | 102 | If a file is found with the appropriate base filename above and one of the following extensions, then the following actions are carried out: 103 | A filename ending in `.tar` is untarred onto the appropriate partition. 104 | A filename ending in `.tar.xz` is decompressed, and untarred onto the appropriate partition. 105 | 106 | So to add/replace some custom files on your distro, you just need to create a tar ball with the correct name, optionally compress it using XZ, drop it into the distro folder and install the distro as usual - simples! Some helper scripts are provided to help create these tarballs (see the Helpers folder). 107 | 108 | (A filename with the appropriate basename ending in `.txt` is processed according to the Advanced Customisation section described below.) 109 | 110 | If you add any other distros, flavours or OS partition names, you need to name the custom files according to the filename format above and add the following line to the partition_setup.sh script for that distro: 111 | `if [ -e /mnt/customise.sh ]; then . /mnt/customise.sh; fi` 112 | This technique can also be used on the data partition - just create a partition_setup.sh file containing just this line. However, it is not really necessary as you could more easily just replace the original data.tar.xz file with your own, since it only contains a README.txt file. 113 | 114 | ### How to Create a Custom Tarball 115 | 116 | These instructions assume you already have a working installation of a distro on the RPi and you want to capture the customisations you have made for future installations of the same distro. 117 | 118 | 1. Firstly you need to start from a working installation of the distro. I suggest you use NOOBS to install the distro first. 119 | 2. Modify any existing, or create any new files that you want to be included in your customisation. 120 | 3. For manageability I suggest creating a simple text file that contains a list of all the new/modified files that you want, with one fullpathname on each line. 121 | For example: 122 | 123 | ```$>sudo nano files.txt
124 | /etc/network/interfaces 125 | /etc/init.d/rc.local 126 | ``` 127 | 128 | 4. Now create the tar ball using this text file as input, as follows: 129 | 130 | ```$>sudo tar cvf <flavour>_<partitionName>.tar -T files.txt 131 | $>sudo xz <flavour>_<partitionName>.tar 132 | ``` 133 | 134 | (See the Helpers folder for alternative ways to do this using scripts). 135 | 5. Copy the tarball to the appropriate OS folder. 136 | 137 | ### Advanced Customisation 138 | Sometimes, you may want to have greater control over your customisations. Maybe you want to: 139 | * segregate them into separate tar files for distinct uses. 140 | * give them better names according to their use. 141 | * have easier control over which ones should be installed. 142 | * share files between different flavours of the same distro. 143 | * provide raw files that are not tarred or compressed, e.g. by direct copying on to the recovery partition using Windows. 144 | For these and other uses, the (flavour)_(partitionName).txt file can be useful. 145 | 146 | This text file contains a list of files (one per line) to be installed to the distro AFTER the above `.tar` or `.tar.xz` files have been installed. In this way some tweaks can be applied to existing .tar files without having to modify/rebuild them. 147 | 148 | The text file is processed a line at a time to extract the filenames to be processed. 149 | Any filename ending in `.tar` is untarred to the root of the partition. 150 | Any filename ending in `.tar.xz` is decompressed and then untarred to the root of the partition. 151 | Any other filename is copied directly to the partition. 152 | 153 | NOTE: If you are already using a `(flavour)_(partitionName).tar(.xz)` file, you should NOT specify it in this text file as well, otherwise it would be installed twice. 154 | 155 | If you are directly copying files, you may need to provide additional information in the form of optional fields on the same line. 156 | 157 | There are five fields as follows (separated by spaces): 158 | 159 | Filename destination attributes user group 160 | 161 | Only the filename field is mandatory and it is the only field used for TAR and XZ files; the others can be omitted and default values will then be applied. If you want to omit a field but follow it with another field, then use a '#' instead to keep the relative placement of the fields. 162 | 163 | Blank lines will be ignored. 164 | Comments can be added by starting the line with a '#' in the first column, or adding the comment after field 5. 165 | 166 | Here are some examples to illustrate this: 167 | * Readme.txt 168 | * Readme.txt # 0644 169 | * nc-helpers.tar 170 | * wifi/interfaces /etc/network 0644 root root 171 | * wifi/wpa_supplicant.conf /etc/wpa_supplicant 0600 root root 172 | 173 | (The last 2 examples above show how using this direct copy technique, it is possible to specify the '/etc/network/interfaces' and '/etc/wpa_supplicant/wpa_supplicant.conf' files for easy wifi setup from Windows, whilst specifying the correct attributes and avoiding the problem of creating Tar files from Windows.) 174 | 175 | #### Filename 176 | This is the name of the file you want to copy from the recovery partition. 177 | It can be stored in the /os/distro folder, or any subfolder. If you put it in a subfolder then this must be specified. 178 | e.g. 179 | To copy the file `/os/Raspbian/readme.txt`, use `readme.txt` 180 | To copy the file `/os/Raspbian/folder/readme.txt`, use `folder/readme.txt` 181 | The folder name is only used to locate the source file. It is not used as part of the destination folder. 182 | This field is mandatory. 183 | 184 | If you need to include a filename that has embedded spaces in it, then you must enclose it in double quotation marks: 185 | e.g. 186 | * "my wifi/interfaces" /etc/network 0644 root root 187 | 188 | #### Destination 189 | This is the name of the destination folder where the file is to be stored on the target partition, relative to the root. E.g. `/home/pi`. It must begin with a slash, but have no trailing slash. 190 | This field is optional. If not specified, then the root directory is used. 191 | If you need to include a destination pathname that includes embedded spaces,then enclose this in double quotations. 192 | 193 | #### Attributes 194 | This specifies the attributes to be applied to the new file using the chmod command. e.g. `0644`. I guess options such as `+x` would also work but I've not tried. 195 | 196 | #### User 197 | This specifies the new user of the file e.g. `pi` or `root` etc. 198 | 199 | #### Group 200 | This specifies the new group of the file e.g. `root` 201 | 202 | ### Selecting a Method of customisation 203 | It can be confusing to decide which type of customisation to use, so here is a short guide. 204 | * TAR files are very convenient when there are many related files to be installed, possibly in different folders, and where file permissions or ownership are important. They capture the contents, ownership and permissions of each file into a single TAR file which is then easily managed. So they are best created directly on an existing distro on the RPi. Not so many compression programs allow you to create a TAR file on Windows (7-zip can), but nevertheless, the file permissions and attributes cannot be set. Plain TAR files are not compressed and append 2 blocks of 512 bytes at the end. So the minimum size of a TAR file is 10kB. This can be quite an overhead if you only want to install a couple of small script files. 205 | * TAR.XZ files are TAR files that have been compressed using the XZ program. They therefore retain the advantages of the TAR file's manageability, but also avoid the TAR file's largish size. It is best to compress them on the RPi, but it can be done on another Linux distro, but not so easily on Windows. 206 | * If you want to create your customisation on Windows, referencing files from the TXT file may be the easiest method. This does not provide any compression, nor does it collect the separate files into one single file for manageability. However, it does provide control of user permissions and ownership. This is also a convenient method if you only want to install 1 or 2 small files. If you are creating script files on Windows, be careful to choose Linux line endings. Some editing programs, like Notepad++ allow you to visualise the line endings and change them from Windows to Linux and vice versa. 207 | 208 | ## Testing & Retrospective customisation 209 | 210 | Since noobsconfig executes after NOOBS has installed a distro, it can be a lengthy process to test any customisations as they are developed, because each test potentially means installing a distro and waiting to see the result. Also, if you already have a Raspbian distro installed by noobs, then you probably don't want to have to overwrite it all just to test your scripts. Or maybe you have created a new 'flavour' to install your customisations and you want to install them onto your existing distro that was installed as another flavour. 211 | 212 | There is a script called `retro.sh` that is placed on the root of the recovery partition to aid testing, or to apply a customisation retrospectively, i.e. after a distro has already been installed by NOOBS. 213 | 214 | The purpose of `retro.sh` is to apply a set of customisations from the recovery partition to the currently installed distro, after that distro has been installed and is now executing. It works on a partition at a time, so if your distro has 2 partitions that you want to customise, you need to run it once for each partition. It requires a bit of work to setup the environment first, and a few arguments to tell it what it does, but these are easily captured into a script. 215 | 216 | The main thing that needs to be done is to mount the recovery partition so that it is accessible. Also note that the installation has to be done by the root user (or using sudo) since it may need to (over)write system files. 217 | 218 | ### retro.sh 219 | Usage: sudo ./retro.sh [source folder] [destination folder] [(flavour)_(partitionName)] 220 | Example1: sudo ./retro.sh /mnt/os/Raspbian / Raspbian_root 221 | Example2: sudo ./retro.sh /mnt/os/Raspbian /boot/ Raspbian_boot 222 | 223 | ### Example use of retro.sh 224 | Here is an example script file that automates the retrospective installation or testing of a Raspbian customisation. 225 | 226 | #!/bin/sh 227 | # Make sure only root can run our script 228 | if [ "$(id -u)" != "0" ]; then 229 | echo "This script must be run as root" 1>&2 230 | exit 1 231 | fi 232 | 233 | #Mount the recovery partition 234 | mount /dev/mmcblk0p1 /mnt 235 | cdir=`pwd` 236 | cd /mnt 237 | #Install the customisations 238 | ./retro.sh /mnt/os/Raspbian /boot/ RaspbianMyFlavour_boot 239 | ./retro.sh /mnt/os/Raspbian / RaspbianMyFlavour_root 240 | #Restore 241 | cd $cdir 242 | sync 243 | sleep 1 244 | umount /mnt 245 | echo "Customisation done." 246 | 247 | ## Further Examples 248 | You will find some examples of how to apply some configurations to Raspbian in the Examples/Raspbian folder. 249 | Please see zeroconf_wifi.md for a very quick setup of a WPA/WPA2 wifi network. 250 | I welcome other examples, particularly for the other Linux distros. 251 | -------------------------------------------------------------------------------- /dev/customise.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -x 4 | 5 | #Get the location of the OS images 6 | imagefolder=`sed -n "s/.*\"imagefolder\".*:.*\"\(.*\)\".*/\1/p" $MOUNTPOINT/cmdline.txt 66 | 67 | # cleanup mountpoint 68 | umount $MOUNTPOINT 69 | rmdir $MOUNTPOINT 70 | 71 | if [-e /mnt/customise.sh ]; then /mnt/customise.sh; fi 72 | -------------------------------------------------------------------------------- /dev/os/Pidora/partition_setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ ${part1} == '' || ${part2} == '' ]]; then 4 | echo "error: part1 and part2 not specified" 5 | exit 1 6 | fi 7 | 8 | # create mount points 9 | mkdir /tmp/1 10 | mkdir /tmp/2 11 | 12 | # mount partitions 13 | mount ${part1} /tmp/1 14 | mount ${part2} /tmp/2 15 | 16 | if [ -e /mnt/customise.sh ]; then /mnt/customise.sh; fi 17 | 18 | # adjust files 19 | sed -ie "s|root=/dev/mmcblk0p[0-9]|root=${part2}|" /tmp/1/cmdline.txt 20 | sed -ie "s|^.* / |${part2} / |" /tmp/2/etc/fstab 21 | sed -ie "s|^.* /boot |${part1} /boot |" /tmp/2/etc/fstab 22 | 23 | # clean up 24 | umount /tmp/1 25 | umount /tmp/2 26 | 27 | 28 | -------------------------------------------------------------------------------- /dev/os/RaspBMC/partition_setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/ash 2 | 3 | # Let OSIRIS see what we are doing 4 | set -x 5 | # We really don't want automated fscking 6 | tune2fs -c 0 $part2 7 | # Temporary mounting directory 8 | mkdir -p /tmp/mount 9 | 10 | if [ -e /mnt/customise.sh ]; then /mnt/customise.sh; fi 11 | 12 | # Fix the cmdline.txt 13 | mount $part1 /tmp/mount 14 | eval "sed -e s:/dev/mmcblk0p2:$part2: -i /tmp/mount/cmdline.txt" 15 | umount /tmp/mount 16 | # Wait 17 | sync 18 | # Fix the fstab 19 | mount $part2 /tmp/mount 20 | eval "sed -e s:/dev/mmcblk0p1:$part1: -i /tmp/mount/etc/fstab" 21 | eval "sed -e s:/dev/mmcblk0p2:$part2: -i /tmp/mount/etc/fstab" 22 | umount /tmp/mount 23 | # Wait 24 | sync 25 | 26 | 27 | -------------------------------------------------------------------------------- /dev/os/Raspbian/partition_setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -ex 4 | 5 | if [ -z "$part1" ] || [ -z "$part2" ]; then 6 | printf "Error: missing environment variable part1 or part2\n" 1>&2 7 | exit 1 8 | fi 9 | 10 | mkdir -p /tmp/1 /tmp/2 11 | 12 | mount "$part1" /tmp/1 13 | mount "$part2" /tmp/2 14 | 15 | if [ -e /mnt/customise.sh ]; then /mnt/customise.sh; fi 16 | 17 | sed /tmp/1/cmdline.txt -i -e "s|root=/dev/[^ ]*|root=${part2}|" 18 | sed /tmp/2/etc/fstab -i -e "s|^.* / |${part2} / |" 19 | sed /tmp/2/etc/fstab -i -e "s|^.* /boot |${part1} /boot |" 20 | 21 | 22 | umount /tmp/1 23 | umount /tmp/2 24 | -------------------------------------------------------------------------------- /dev/os/data_partition/partition_setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #PWD=/mnt2 = root of 1st FAT partition of OS. 3 | 4 | set -ex 5 | 6 | if [ -e /mnt/customise.sh ]; then /mnt/customise.sh; fi 7 | 8 | -------------------------------------------------------------------------------- /dev/retro.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #installs a Distro's customisations restrospectively. 4 | #Put customisations on USB stick and mount somewhere 5 | #Only does 1 partition at a time 6 | 7 | #Args: 8 | #$1 = source imagefolder = /usbmount/os/distro 9 | #$2 = destination partition = / or /boot/ 10 | #$3 = flavour_label = name of customisation. 11 | 12 | set -x 13 | 14 | process_file() 15 | { 16 | local arg1="" 17 | local arg2="" 18 | local arg3="" 19 | local arg4="" 20 | local arg5="" 21 | 22 | #Complicated rubbish to process quoted spaced arguments to this function! 23 | local inquote=0 #State of inside/outside quotations 24 | local inarg=0 #State of within an argument 25 | local narg=0 #number of arguments processed 26 | local arg="" #the current argument 27 | 28 | #Treat the arguments as one string and process each character. 29 | #inarg & inquote keep track of the state. 30 | for pos in `seq 1 ${#@}` 31 | do 32 | add=0; 33 | inc=0; 34 | c=`expr substr "$@" $pos 1` 35 | # echo "$c" 36 | case "$c" in 37 | "\"") 38 | inquote=`expr 1 - $inquote` 39 | if [ $inquote -eq 0 ]; then 40 | inc=1 #indicate end of an argument 41 | else 42 | inarg=1; #indicate we have started an argument 43 | fi 44 | ;; 45 | 46 | " ") 47 | if [ $inarg -eq 1 ]; then 48 | if [ $inquote -eq 0 ]; then 49 | inc=1 #indicate end of an argument 50 | else 51 | add=1 #add embedded space to argument 52 | fi 53 | fi 54 | ;; 55 | *) 56 | inarg=1 #indicate we have started an argument 57 | add=1 #add character to argument 58 | ;; 59 | esac 60 | 61 | if [ $add -eq 1 ]; then 62 | arg="$arg$c" #Append the current character 63 | fi 64 | 65 | if [ $inc -eq 1 ]; then 66 | #assign the current argument to the next variable 67 | narg=`expr $narg + 1` 68 | var="arg$narg" 69 | cmd="${var}=\"$arg\"" 70 | eval "$cmd" 71 | inarg=0 72 | arg="" 73 | fi 74 | done 75 | if [ $inarg -eq 1 ]; then 76 | #last incomplete argument needs to be assigned to the next variable 77 | narg=`expr $narg + 1` 78 | var="arg$narg" 79 | cmd="${var}=\"$arg\"" 80 | eval "$cmd" 81 | inarg=0 82 | arg="" 83 | fi 84 | ############ 85 | 86 | #Here we just give the arguments meaningful names 87 | local tarfile="$arg1" 88 | local dstsubfolder="$arg2" 89 | local attributes="$arg3" 90 | local user="$arg4" 91 | local group="$arg5" 92 | 93 | if [ "$dstsubfolder" = "#" ]; then dstsubfolder=""; fi 94 | if [ "$attributes" = "#" ]; then attributes=""; fi 95 | if [ "$user" = '#' ]; then user=""; fi 96 | if [ "$group" = '#' ]; then group=""; fi 97 | 98 | if [ -e "$arg_srcfolder/$tarfile" ]; then 99 | #Copy custom file to the SD card partition root 100 | #cp $arg_srcfolder/$tarfile $arg_dstfolder 101 | #decompress & Untar the custom file 102 | #cd $arg_dstfolder 103 | ext=`echo $tarfile|awk -F . '{print $NF}'` 104 | case "$ext" in 105 | "xz" ) 106 | xz -dc "$arg_srcfolder/$tarfile" | tar x -C "$arg_dstfolder" 107 | ;; 108 | "tar" ) 109 | tar xvf "$arg_srcfolder/$tarfile" -C "$arg_dstfolder" 110 | ;; 111 | * ) 112 | fname=`basename "$tarfile"` 113 | pathname=`dirname "$tarfile"` 114 | mkdir -p "$arg_dstfolder$dstsubfolder" 115 | cp "$arg_srcfolder/$tarfile" "$arg_dstfolder$dstsubfolder/$fname" 116 | if [ "$attributes" != "" ]; then chmod $attributes "$arg_dstfolder$dstsubfolder/$fname"; fi 117 | ug="" 118 | if [ "$user" != "" ]; then ug=$user; else ug=""; fi 119 | if [ "$group" != "" ]; then ug=$ug:$group; fi 120 | if [ "$ug" != "" ]; then chown $ug "$arg_dstfolder$dstsubfolder/$fname"; fi 121 | ;; 122 | esac 123 | fi 124 | } 125 | 126 | custom_part() 127 | { 128 | #parameters 129 | # $1 = srcfolder eg /mnt/os/xxxxx 130 | # $2 = dest folder eg /usbmount 131 | # $3 = imagename eg Flavour_label 132 | local arg_srcfolder=$1 133 | local arg_imagename=$3 134 | local arg_dstfolder=$2 135 | 136 | #Look for a tar file 137 | tarfile=$arg_imagename.tar 138 | process_file "$tarfile" 139 | 140 | #Look for a tar.xz file 141 | tarfile=$tarfile.xz 142 | process_file "$tarfile" 143 | 144 | #Look for a txt file 145 | local txtfile=$arg_imagename.txt 146 | #Does the custom file exist? 147 | if [ -e $arg_srcfolder/$txtfile ]; then 148 | while read line 149 | do 150 | #remove trailing CR 151 | tarfile=`echo $line | tr -d '\r'` 152 | if [ ! -z "$tarfile" ]; then 153 | #remove lines starting with '#' 154 | tarfile=`echo $tarfile | sed '/^#/d'` 155 | fi 156 | if [ ! -z "$tarfile" ]; then 157 | #Only process non-blank lines 158 | process_file "$tarfile" 159 | fi 160 | done<$arg_srcfolder/$txtfile 161 | fi 162 | cd /mnt 163 | 164 | sync 165 | } 166 | 167 | custom_part "$1" "$2" "$3" 168 | 169 | -------------------------------------------------------------------------------- /noobsconfig.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/procount/noobsconfig/e1370d5e2e523e700bf2b46fffe2a31fc5d8539b/noobsconfig.zip -------------------------------------------------------------------------------- /zeroconf_wifi.md: -------------------------------------------------------------------------------- 1 | NOOBSConfig - Zero config wifi - Quickstart 2 | ============================== 3 | 4 | This file explains how to very quickly configure your NOOBS Raspbian installation to connect to your wifi on first boot. It assumes your wifi dongle is supported by Raspbian. 5 | 6 | 1. On your PC, format your SD card to full capacity. 7 | 2. Unzip/copy the standard NOOBS installation files onto it, as per the standard instructions. 8 | 3. Unzip/copy the noobsconfig.zip to the root of your SD card, overwriting any existing files. 9 | Your NOOBS SD card is now modified to support customisations! 10 | 4. From the Examples\Raspbian\wifi folder of this repository, copy the Raspbian_root.txt and the wifi folder to the \os\distro\Raspbian folder of your SD card. 11 | 5. Edit the \os\distro\Raspbian\wifi\wpa_supplicant.conf file and replace "MyNetwork" with the SSID name of your wifi network and "MyPassword" with your wifi network's password or key. 12 | 6. Insert your SD card in the RPi and install Raspbian. 13 | 14 | After Raspbian is installed the Rpi will then reboot into Raspbian as usual, except now it should be configured to automatically connect to your WPA/WPA2 wifi network using DHCP. 15 | 16 | If your networking needs are different, simply modify the interfaces and wpa_supplicant.conf files accordingly before installation. 17 | 18 | 19 | --------------------------------------------------------------------------------