|
| 1 | +## INTRODUCTION |
| 2 | +fs-cooks uses debootstrap to pull core Linux packages to build linux traballs, all implementations are developer-friendly and mostly kinda [udroid](https://github.com/RandomCoderOrg/ubuntu-on-android) centric (for now) |
| 3 | + |
| 4 | +### filestructure |
| 5 | +<hr> |
| 6 | + |
| 7 | +#### Top-Level (1) |
| 8 | +the top-level contains some example build scripts which are lightweight to build and beginning of directories |
| 9 | +``` |
| 10 | +. |
| 11 | +├── build-hirsute-raw.sh -> cook.sh |
| 12 | +├── build-impish-raw.sh |
| 13 | +├── cook.sh |
| 14 | +├── core |
| 15 | +├── out |
| 16 | +├── plugins |
| 17 | +├── README.md |
| 18 | +└── setup.sh |
| 19 | +``` |
| 20 | +here: |
| 21 | +- **core**: contains binaries and different sources that used in the build process |
| 22 | +- **out**: All the filesystem and tarball packages are created here |
| 23 | +- **plugins**: contains scripts that combine core sources to make tarball building easy |
| 24 | +<hr> |
| 25 | + |
| 26 | +**important files/folders to notice** |
| 27 | +###### `~/core/defaults` |
| 28 | +defaults folder contains some heavy templates to build DE ready tarballs like mate,xfce4,kde |
| 29 | +###### `~/plugins/envsetup` |
| 30 | +contains functions that can be used for cmd line building and integrating in scripts |
| 31 | +- useful functions in `envsetup`: |
| 32 | + |
| 33 | +<kbd>do_mount()</kbd>: mounts the rootfs directories in recursive after checking is directories already mounted |
| 34 | +> takes one argument: location of rootfs directorie |
| 35 | +
|
| 36 | +```bash |
| 37 | +do_mount "/path/to/fs" |
| 38 | +``` |
| 39 | + |
| 40 | +<kbd>do_debootstrap()</kbd> bootstraps linux to a directories of specified arch |
| 41 | +```bash |
| 42 | +do_debootstrap "out/udroid-test" "arm64" |
| 43 | +``` |
| 44 | +###### TODO ( need to write more ) |
| 45 | + |
| 46 | +# AIM |
| 47 | +> in one line: able to produce multiarch ubuntu hirsute & impish tarballs with |
| 48 | +
|
| 49 | +```bash |
| 50 | +source plugins/envsetup |
| 51 | +SUITE=impish |
| 52 | +do_debootstrap "out/fs" "arm64" |
| 53 | +``` |
| 54 | +### Quick build scripts |
| 55 | +- `build-impish-raw.sh`: to build raw ubuntu 21.10 tarballs |
| 56 | +- `build-hirsute-raw.sh`: to build raw ubuntu 21.04 tarballs |
| 57 | +> others are experimental ( may break things ) |
| 58 | +
|
| 59 | +### functions |
| 60 | +> recommended for devolopers |
| 61 | + |
| 62 | +- `do_mount()`: mounts target filesystem directories ( recursive mode ) `do mount /path/to/fs` |
| 63 | +- `is_mounted()`: checks is filesystem mounted to host |
| 64 | +- `list_parser()`: convets new line separated contents in a file to list variable |
| 65 | +- `depends_on()`: for locking dependencies ( checks is a package is installed with `command`) |
| 66 | +- `dpkg_depends_on()`: check for dependencies with dpkg for non-binarie bundle applications |
| 67 | +- `see_for_directory()`: check for directories & set `es` to false if not found |
| 68 | +- `no_to_directory()`: exits if directory given is present |
| 69 | +- `foreign_arch()`: checks does target arch matches with host architecture |
| 70 | +- `includes_packages()`: takes care of extrapackges when a variable `INCLUDE_PACKAGES` is set with packages |
| 71 | +- `do_debootstrap()`: bootstraps linux to with target arch to target directorie |
| 72 | +- `do_second_stage()`: if foreign arch triggers second stage |
| 73 | +- - `do_qemu_user_emulation()` sets up qemu binaries in chroot |
| 74 | +- `do_chroot_ae()`: to run command in chroot |
| 75 | +- - `run_cmd()`: alternative for `do_chroot_are()` |
| 76 | +- `do_compress()`: takes care of compressing tarballs without messy device file |
| 77 | +- - `do_tar_gzip()`: to compress in gzip format |
| 78 | +- - `do_tar_bzip()`: to compress in bzip format |
| 79 | +- - `do_tar_lz4()`: to compress in lzip/lz4 format |
| 80 | +- `arch_translate()`: takes care of translating arch to find qemu static builds |
| 81 | +- `die()`: to echo an error message & exit if `ENABLE_EXIT` is set to true |
| 82 | +- `warn()`: like `die()` without exit |
| 83 | +- `shout()`: for printing logs |
| 84 | +- `msg()`: for normal echo |
| 85 | + |
| 86 | +### Environment Variables |
| 87 | +- `ENABLE_EXIT` ( true | false ): to exit on error |
| 88 | +- `INCLUDE_PACKAGES`: to set extra packages to install in the bootstrap process |
| 89 | +- `SUITE`: to set target suite to bootstrap |
| 90 | + |
| 91 | +### MISC variable |
| 92 | +- `SUDO` (not user-defined) : if non-root user then value is path of sudo, if root no value/null string |
| 93 | + |
| 94 | +<hr> |
| 95 | + |
| 96 | +- just make sure not to mess up with existing function ( inform maintainers if any changes made in existing functions ) 👌 |
0 commit comments