ShorTie
Posts: 106
Joined: Sun May 12, 2013 3:54 pm

Minimal rPi os maker

Sun Mar 22, 2015 12:20 pm

my_pi_os.sh

https://github.com/ShorTie8/my_pi_os

This is a highly configurable Minimal Operating System maker using your Pi for the Pi.
Because the Pi is Arm based, other test boxes are not supported.
It is a Net-Install of the OS pulling files from either mirrordirector.raspbian.org,
or for rpi2's it can use ftp.us.debian.org for the packages.

1. Choose your build method
1. Make a Image file.
2. Make a Image file then write it to a sdcard at the end.
3. Just use a sdcard. If you choose this but no /dev/sdx if found it will make an image.

2. Choose between either wheezy > stretch for your distribution installation packages. For rpi2's sid and testing.

3. Pick either the foundations bootloader/kernels or the no-kernel-bootloader/Debian kernels.

4. For the no-kernel-bootloader option you must define the version of pi for correct kernel.

5. For rpi2 users you can choose to use ftp.debian for files,
bootloader option still valid and rpi2 must be defined to work.
sid and testing only work with ftp.debian.

6. Define hostname, domain_name and root_password.

7. Pick your root file system ext4, btrfs or f2fs. ext4 has 4 different format options.
For btrfs, you can choose apt-get or github tools if mkfs.btrfs is not found.
For both btrfs and f2fs github tools, install is done to both the system and image/sdcard.

8. Either use dhcp or assign a static ip.

9. Define your timezone, locales and keyboard, or rem out or leave blank to use currect profiles

10. List packages you want cdebootstrap to include, becarefull because dependencies are not checked.

11. Lastly define the stuff you want apt-get to install, recommended way so dependencies are installed.
For clearity this is broken down into 4 options, like the following example.
1. rasp_stuff="libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc"
2. basic_stuff="dbus fake-hwclock psmisc"
3. net_stuff="ssh ntp"
4. more_stuff="mlocate raspi-copies-and-fills raspi-config"

Have A Great Day
ShorTie ;)

Edit: Added exclude variable for cdebootstrap
Edit2: Added sid and testing
Edit3: Added USB current hack
Edit4: Moved to github and added a few things with some fixes
Last edited by ShorTie on Fri May 29, 2015 10:26 am, edited 5 times in total.

User avatar
DougieLawson
Posts: 41047
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Minimal rPi os maker

Sun Mar 22, 2015 2:38 pm

Is there any way to get it to purge/not install some of your default packages?

It's installing isc-dhcp-client, I want to replace that with dhcpcd (which is less buggy).
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

ShorTie
Posts: 106
Joined: Sun May 12, 2013 3:54 pm

Re: Minimal rPi os maker

Sun Mar 22, 2015 3:39 pm

That is a dependency of ssh that debian installs.
You can change up 'net_stuff="ssh ntp"' to install individual packages.
That is why I broke it up into multiple xxxx_stuff fields to make it easier as to who/what is doing things.
Anyone/all of the xxxx_stuff lines can be rem'd out or left empty, so nothing happens.
I tried to make it as verbose and easily configurable as I could, Not only for my debugging, but so people could follow along as to who/what/where/when/why things where happening.

ShorTie

Oops, my bad, isc-dhcp-client is something that cdebootstrap pulls in, not ssh.
So no I don't think that can be changed, Sorry.
There is a place at the bottom, between ***'s, you could add in a apt-get purge and add apt-get it in just like normal.
'# Add even more 'chroot root apt-get's here if you want'
just start your lines off with 'chroot sdcard apt....'

ShorTie
Posts: 106
Joined: Sun May 12, 2013 3:54 pm

Re: Minimal rPi os maker

Mon Mar 23, 2015 12:58 am

Thank You Mr. DougieLawson

Sorry I made the above reply while at work with out fully investigating the situation.
cdebootstrap does have a exclude option and I have added it in.
So you can do a
"exclude=isc-dhcp-client"
then add dhcpcd to like net_stuff
"net_stuff="ssh ntp dhcpcd"
I tried it and it does seem to work fine.
None of the example I looked at had so I guess I never considered it.

Thankz Agian
Have A Great Day
ShorTie

ShorTie
Posts: 106
Joined: Sun May 12, 2013 3:54 pm

Re: Minimal rPi os maker

Sat Mar 28, 2015 10:00 am

Someone on irc was asking about sid, so I added sid and testing as options.

ShorTie
Posts: 106
Joined: Sun May 12, 2013 3:54 pm

Re: Minimal rPi os maker

Thu Apr 02, 2015 6:10 pm

Added USB current hack

Have A Great Day
ShorTie :(

S711
Posts: 3
Joined: Wed Apr 22, 2015 7:28 am

Re: Minimal rPi os maker

Wed Apr 22, 2015 7:42 am

HI,
Thanks for your script !
I dont understand the difference between this two lines

Code: Select all

sdcard=
sdcard_device=
What do i have to write for:

Code: Select all

sdcard=
If i dont write /dev/sdx for

Code: Select all

sdcard_device=
I have to write the path where the sdcard is mounted? Thats expect the sdcard is formated in ext4 for exemple?

In your fonction fail() I dont understand why you code:

Code: Select all

    umount sdcard/proc

instead of:

Code: Select all

    umount $sdcard/proc


Sorry for my bad english
Thx

S711
Posts: 3
Joined: Wed Apr 22, 2015 7:28 am

Re: Minimal rPi os maker

Thu Apr 23, 2015 7:43 am

In your fonction fail() I dont understand why you code:

Code: Select all

umount sdcard/proc
instead of:

Code: Select all

umount $sdcard/proc
I'am wrong it's correct.

In this following lines I dont understand why you dont use "$sdcard" instead of "sd" or "sda"?

Code: Select all

    if ! (cat /proc/partitions | grep sd); then
        echo "Oops, no usb device ($sdcard) found"

Code: Select all

        if (cat /etc/mtab | grep sda); then
For example when i plug my sdcard by usb adaptator it's on /dev/sde

ShorTie
Posts: 106
Joined: Sun May 12, 2013 3:54 pm

Re: Minimal rPi os maker

Thu Apr 23, 2015 10:41 am

The difference between sdcard and sdcard_device, is sdcard is used to determine if you want to make a sdcard or image.
Where as sdcard_device is used at the end to write an image to a sdcard.

Code: Select all

sdcard=/dev/sda 			# Leave blank or remark out to make image
#write_image_to_sdcard=yes	# Remark out or leave blank to not have image writen to sdcard_device at end of making an image
image_name=my_pi_os.img 	# For safty sakes, always provide a name Pleaze
image_size=888  			# Enough for a Basic install
sdcard_device=/dev/sda  	# Device to write image to at end if making an image
The sdcard in the fail() is a temporary directory is made and used to mount for stuff thus way there is no $

As far as "if ! (cat /proc/partitions | grep sd); then", it is not doing much but just checking if there is a usb device there or not.
As far as "if (cat /etc/mtab | grep sda); then" that I think might be a same bug I need to look at If your sdcard is off at " /dev/sde".
But you should still be able to make an image and then write it to the sdcard later, Sorry.
Kinda busy right now, So it may be a little bit till I get to it though. :?

Have A Great Day
ShorTie

S711
Posts: 3
Joined: Wed Apr 22, 2015 7:28 am

Re: Minimal rPi os maker

Fri Apr 24, 2015 2:06 pm

Hi,
Thanks for reply.
Your script need to be execute from a Raspberry or it works from any distribution like Ubuntu (for my case)?
Beause the script fail after the command:

Code: Select all

mount -v --bind /dev/pts sdcard/dev/pts
It says "the mount point sdcard/dev/pts doesnot exist". I think there is a problem during the cdebootstrap

Code: Select all

cdebootstrap --arch armhf ${release} sdcard $http ${include} $exclude --allow-unauthenticated && sync
Because there is the message:

Code: Select all

E: Execution failed: Exec format error
E: Internal error: install

ShorTie
Posts: 106
Joined: Sun May 12, 2013 3:54 pm

Re: Minimal rPi os maker

Sat Apr 25, 2015 7:48 am

As is stated in the 1st line "using your Pi for the Pi."
It is intended to be run on your Pi.
Because the Pi is "--arch armhf" it will not run on a regular pc.

Have A Great Day
ShorTie ;)

MrBool
Posts: 122
Joined: Sat Jul 05, 2014 9:51 am

Re: Minimal rPi os maker

Sat May 09, 2015 1:21 pm

During running of the my_pi_os.sh I have got following error:

Code: Select all

Starting dphys-swapfile swapfile setup ...
want /var/swap=100MByteswapoff: /var/swap: swapoff failed: No such file or directory
/sbin/dphys-swapfile: ERROR: swap file /var/swap missing! you need to first run  /sbin/dphys-swapfile setup  to generate one
done

ShorTie
Posts: 106
Joined: Sun May 12, 2013 3:54 pm

Re: Minimal rPi os maker

Sun May 10, 2015 8:41 am

Ya, that is ok, "During running of the my_pi_os.sh"
The /var/swap file will be created during the 1st boot.
And all will be fine.

Have A Great Day
ShorTie ;)

SonOfAMotherlessGoat
Posts: 690
Joined: Tue Jun 16, 2015 6:01 am

Re: Minimal rPi os maker

Fri Jul 17, 2015 6:01 am

Trying out the script now, looks like it doesn't check for git before trying to clone repo's. Tried doing an f2fs install and caught it when it said 'no mkfs.f2fs found' and didn't fail out of the script but tried to keep going. I'll open an issue on github for it...
Account Inactive

LinBits
Posts: 4
Joined: Sat Mar 12, 2016 12:55 am

Re: Minimal rPi os maker

Sat Mar 12, 2016 2:58 am

ShorTie wrote:my_pi_os.sh

https://github.com/ShorTie8/my_pi_os

This is a highly configurable Minimal Operating System maker using your Pi for the Pi.
Because the Pi is Arm based, other test boxes are not supported.
It is a Net-Install of the OS pulling files from either mirrordirector.raspbian.org,
or for rpi2's it can use ftp.us.debian.org for the packages.

1. Choose your build method
1. Make a Image file.
2. Make a Image file then write it to a sdcard at the end.
3. Just use a sdcard. If you choose this but no /dev/sdx if found it will make an image.

2. Choose between either wheezy > stretch for your distribution installation packages. For rpi2's sid and testing.

3. Pick either the foundations bootloader/kernels or the no-kernel-bootloader/Debian kernels.

4. For the no-kernel-bootloader option you must define the version of pi for correct kernel.

5. For rpi2 users you can choose to use ftp.debian for files,
bootloader option still valid and rpi2 must be defined to work.
sid and testing only work with ftp.debian.

6. Define hostname, domain_name and root_password.

7. Pick your root file system ext4, btrfs or f2fs. ext4 has 4 different format options.
For btrfs, you can choose apt-get or github tools if mkfs.btrfs is not found.
For both btrfs and f2fs github tools, install is done to both the system and image/sdcard.

8. Either use dhcp or assign a static ip.

9. Define your timezone, locales and keyboard, or rem out or leave blank to use currect profiles

10. List packages you want cdebootstrap to include, becarefull because dependencies are not checked.

11. Lastly define the stuff you want apt-get to install, recommended way so dependencies are installed.
For clearity this is broken down into 4 options, like the following example.
1. rasp_stuff="libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc"
2. basic_stuff="dbus fake-hwclock psmisc"
3. net_stuff="ssh ntp"
4. more_stuff="mlocate raspi-copies-and-fills raspi-config"

Have A Great Day
ShorTie ;)

Edit: Added exclude variable for cdebootstrap
Edit2: Added sid and testing
Edit3: Added USB current hack
Edit4: Moved to github and added a few things with some fixes
Hi
You don't mention pi3, is this os maker able to install debian 8.3 on a pi3 ?
Is there a tutorial on how to use your .sh file please, I have never used anything like it.

ozi
Posts: 1
Joined: Sat Mar 05, 2016 2:24 am

Re: Minimal rPi os maker

Thu Mar 31, 2016 3:26 am

ShorTie wrote:As is stated in the 1st line "using your Pi for the Pi."
It is intended to be run on your Pi.
Because the Pi is "--arch armhf" it will not run on a regular pc.

Have A Great Day
ShorTie ;)
Hi ShorTie

I'm build rpi images on a pc, I use qemu. And the build is much quicker too.
https://wiki.debian.org/QemuUserEmulation


Cheers
Ozi

denismosolov
Posts: 11
Joined: Fri Feb 19, 2016 11:22 am
Location: Russia
Contact: Website

Re: Minimal rPi os maker

Sat Apr 23, 2016 3:02 pm

Hello everyone

We are developing a SaaS application for building RPi images in the cloud. We use qemu too. We will deploy the app soon and publish it's source code on GitHub. The goal is to let everyone create personalized/customized RPi images based on Debian GNU/Linux just in few clicks.
I would really appreciate if you guys share your thoughts about SaaS approach of building images.

Thanks,
Denis

Return to “Raspberry Pi OS”