Skip to content

Commit

Permalink
Merge pull request #33 from 23xvx/add-support-platform-termux
Browse files Browse the repository at this point in the history
Fix typo
  • Loading branch information
SaicharanKandukuri authored Feb 13, 2024
2 parents 16aaa62 + 0116579 commit 6511d76
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 244 deletions.
98 changes: 0 additions & 98 deletions .github/scripts/build-kinetic.sh

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/build-udroid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,36 +42,3 @@ jobs:
with:
name: jammy-raw-amd64
path: jammy-amd64
BuildKineticRaw:
name: build Kinetc (22.10)
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v3

- name: Docker Setup QEMU
uses: docker/setup-qemu-action@v2

- name: Satify Dependencies
run: sudo apt-get update; sudo apt-get install git build-essential binfmt-support qemu-user-static debootstrap -y

- name: Trigger fs-cook
run: sudo bash .github/scripts/build-kinetic.sh

- name: save arm64 builds
uses: actions/upload-artifact@v2
with:
name: kinetic-raw-arm64
path: kinetic-arm64

- name: save armhf builds
uses: actions/upload-artifact@v2
with:
name: kinetic-raw-armhf
path: kinetic-armhf

- name: save amd64 builds
uses: actions/upload-artifact@v2
with:
name: kinetic-raw-amd64
path: kinetic-amd64
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ fs-cooks uses debootstrap to pull core Linux packages to build linux traballs, a
the top-level contains some example build scripts which are lightweight to build and beginning of directories
```
.
├── build-hirsute-raw.sh -> cook.sh
├── build-impish-raw.sh
├── build-jammy.sh -> cook.sh
├── cook.sh
├── build
├── core
Expand All @@ -26,8 +25,6 @@ here:
<hr>

**important files/folders to notice**
###### `~/core/defaults`
defaults folder contains some heavy templates to build DE ready tarballs like mate,xfce4,kde
###### `~/plugins/envsetup`
contains functions that can be used for cmd line building and integrating in scripts
- useful functions in `envsetup`:
Expand All @@ -50,12 +47,11 @@ do_build "out/udroid-test" "arm64"
```bash
source plugins/envsetup
SUITE=impish
SUITE=jammy
do_build "out/fs" "arm64"
```
### Quick build scripts
- `build-impish-raw.sh`: to build raw ubuntu 21.10 tarballs
- `build-hirsute-raw.sh`: to build raw ubuntu 21.04 tarballs
- `build-jammy.sh`: to build raw ubuntu 22.04 tarballs
> others are experimental ( may break things )
### functions ( <kbd>v1.0</kbd> )
Expand All @@ -74,11 +70,15 @@ do_build "out/fs" "arm64"
- `do_second_stage()`: if foreign arch triggers second stage
- - `do_qemu_user_emulation()` sets up qemu binaries in chroot
- `do_chroot_ae()`: to run command in chroot
- - `run_cmd()`: alternative for `do_chroot_are()`
- - `do_chroot_proot_ae` : use **proot** instead of chroot in termux
- - `run_cmd()`: alternative for `do_chroot_ae()`
- - `run_shell_script()` : to run a specific script, alternative for `do_chroot_ae()`
- - `install_pkg()` : to install a specific package inside chroot, alternative for `do_chroot_ae()`
- `do_compress()`: takes care of compressing tarballs without messy device file
- - `do_tar_gzip()`: to compress in gzip format
- - `do_tar_bzip()`: to compress in bzip format
- - `do_tar_lz4()`: to compress in lzip/lz4 format
- - `do_tar_zstd()` : to compress in zstd format
- `arch_translate()`: takes care of translating arch to find qemu static builds
- `COPY()`: to copy files to target filesystem
- `die()`: to echo an error message & exit if `ENABLE_EXIT` is set to true
Expand Down
82 changes: 0 additions & 82 deletions build-kinetic.sh

This file was deleted.

27 changes: 12 additions & 15 deletions plugins/envsetup
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# SOFTWARE.

export ROOT_DIR
export BUILD_PALTFORM="linux"
export BUILD_PLATFORM="linux"

_c_magneta="\e[95m"
_c_green="\e[32m"
Expand All @@ -40,12 +40,12 @@ msg() { echo -e "${*} \e[0m" >&2;:;}

# Check if environment is Termux
if [ "$(uname -o)" = "Android" ]; then
export FS_COOK_PLATFORM="termux"
export BUILD_PLATFORM="termux"
fi

# sudo check
if [ "$(id -u)" != "0" ]; then
if [ "$FS_COOK_PLATFORM" == "termux" ]; then
if [ "$BUILD_PLATFORM" == "termux" ]; then
SUDO=""
else
if command -v sudo &>/dev/null; then
Expand Down Expand Up @@ -111,7 +111,7 @@ do_mount() {

do_unmount()
{
if [ "$FS_COOK_PLATFORM" == "termux" ]; then
if [ "$BUILD_PLATFORM" == "termux" ]; then
lshout "Skip unmount for termux"
else
local chroot_dir=$1
Expand Down Expand Up @@ -241,7 +241,7 @@ foreign_arch() {

includes_packages() {
# comma sperated values
includes="bzip2 pv ${INCLUDE_PACKAGES}"
includes="bzip2 pv openssl zstd ${INCLUDE_PACKAGES}"
# environment variable INCLUDE_PACKAGES
export includes
x=0
Expand All @@ -266,7 +266,7 @@ do_build() {
foreign_arch "$arch"

#Disable cross architecture building in Termux
if [ "$FS_COOK_PLATFORM" == "termux" ]; then
if [ "$BUILD_PLATFORM" == "termux" ]; then
case $worker_arch in
aarch64) termux_arch="arm64" ;;
arm*) termux_arch="armhf" ;;
Expand Down Expand Up @@ -322,11 +322,10 @@ do_build() {
_debootstrap=$(which debootstrap)
fi

if [ "$FS_COOK_PLATFORM" == "termux" ]; then
if [ "$BUILD_PLATFORM" == "termux" ]; then
dpkg_depends_on debootstrap
_debootstrap="$(which debootstrap)"
FOREIGN=""
ENABLE_USER_SETUP=false
fi

(
Expand All @@ -340,7 +339,7 @@ do_build() {
$MIRROR
) || die "Couldn't debootstrap..."

if [ "$FS_COOK_PLATFORM" == "termux" ]; then
if [ "$BUILD_PLATFORM" == "termux" ]; then
lshout "Skipping second stage for termux"
arch_translate "$arch"
else
Expand Down Expand Up @@ -411,7 +410,6 @@ setup_user() {
cp plugins/setup-user.sh $chroot_dir
sed -i "s/FS_USER/$FS_USER/g" $chroot_dir/setup-user.sh
sed -i "s/FS_PASS/$FS_PASS/g" $chroot_dir/setup-user.sh
install_pkg "openssl"
run_cmd "chmod +x /setup-user.sh"
run_cmd "/bin/bash /setup-user.sh"
run_cmd "rm -rf /setup-user.sh"
Expand Down Expand Up @@ -471,7 +469,7 @@ do_chroot_root_ae() {
}

do_chroot_ae() {
if [ $BUILD_PALTFORM == "termux" ]; then
if [ $BUILD_PLATFORM == "termux" ]; then
do_chroot_proot_ae "$@"
else
do_chroot_root_ae "$@"
Expand All @@ -484,7 +482,7 @@ do_compress() {
export chroot_dir=$1
TARGET_FILE="$(basename ${chroot_dir})"

if [ "$FS_COOK_PLATFORM" == "termux" ]; then
if [ "$BUILD_PLATFORM" == "termux" ]; then
if [ ! -d "$chroot_dir" ]; then
lshout "Skip compressing $chroot_dir "
return 0
Expand All @@ -499,7 +497,7 @@ do_compress() {
zstd) do_tar_zstd ;;
*)
shout "Unknown compression type"
shout "all compression: lz,gzip,bzip2"
shout "all compression: lz,gzip,bzip2,zstd"
die "Giving up!!"
;;
esac
Expand Down Expand Up @@ -605,8 +603,7 @@ install_pkg()

banner

if [ "$FS_COOK_PLATFORM" == "termux" ]; then
if [ "$BUILD_PLATFORM" == "termux" ]; then
lshout "Running on termux"
BUILD_PALTFORM="termux"
fi

Loading

0 comments on commit 6511d76

Please sign in to comment.