diff --git a/.github/scripts/build-kinetic.sh b/.github/scripts/build-kinetic.sh deleted file mode 100755 index 9f43b1e..0000000 --- a/.github/scripts/build-kinetic.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env bash - -source plugins/envsetup - -export OVERRIDER_COMPRESSION_TYPE -export ENABLE_EXIT -export ENABLE_USER_SETUP - -SUITE="kinetic" -frn="out/$SUITE-raw" -OVERRIDER_COMPRESSION_TYPE="gzip" -ENABLE_EXIT=true -ENABLE_USER_SETUP=false -PREFIX="${frn}" - -additional_setup() { - -# GitHub workflow specific -# try to add permissions to $chroot_dir/etc/apt/sources.list -sudo chmod +r+w $chroot_dir/etc/apt/sources.list - -cat <<- EOF > $chroot_dir/etc/apt/sources.list -# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to -# newer versions of the distribution. -deb $MIRROR $SUITE main restricted -# deb-src $MIRROR $SUITE main restricted - -## Major bug fix updates produced after the final release of the -## distribution. -deb $MIRROR $SUITE-updates main restricted -# deb-src $MIRROR $SUITE-updates main restricted - -## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu -## team. Also, please note that software in universe WILL NOT receive any -## review or updates from the Ubuntu security team. -deb $MIRROR $SUITE universe -# deb-src $MIRROR $SUITE universe -deb $MIRROR $SUITE-updates universe -# deb-src $MIRROR $SUITE-updates universe - -## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu -## team, and may not be under a free licence. Please satisfy yourself as to -## your rights to use the software. Also, please note that software in -## multiverse WILL NOT receive any review or updates from the Ubuntu -## security team. -deb $MIRROR $SUITE multiverse -# deb-src $MIRROR $SUITE multiverse -deb $MIRROR $SUITE-updates multiverse -# deb-src $MIRROR $SUITE-updates multiverse - -## N.B. software from this repository may not have been tested as -## extensively as that contained in the main release, although it includes -## newer versions of some applications which may provide useful features. -## Also, please note that software in backports WILL NOT receive any review -## or updates from the Ubuntu security team. -deb $MIRROR $SUITE-backports main restricted universe multiverse -# deb-src $MIRROR $SUITE-backports main restricted universe multiverse - -EOF - -# set up pv -lshout "Setting up pv..." -cp $ROOT_DIR/core/pv/pv-${t_arch}.deb $chroot_dir -run_cmd "dpkg -i /pv-${t_arch}.deb" -run_cmd "rm /pv-${t_arch}.deb" - -# clean any archive if exits -apt-get clean - -} - -do_build "$PREFIX-arm64" arm64 -do_build "$PREFIX-armhf" armhf -do_build "$PREFIX-amd64" amd64 - -do_compress "$PREFIX-arm64" -do_compress "$PREFIX-armhf" -do_compress "$PREFIX-amd64" - -do_unmount "$PREFIX-arm64" -do_unmount "$PREFIX-armhf" -do_unmount "$PREFIX-amd64" - -shout "setting up artifacts for GitHub" -msg "creating $SUITE-{arm64,amd64,armhf} directories" -mkdir -pv $SUITE-{arm64,amd64,armhf} - -msg "copying tarballs to directories" -cp -rv $frn-arm64*tar* $SUITE-arm64 -cp -rv $frn-armhf*tar* $SUITE-armhf -cp -rv $frn-amd64*tar* $SUITE-amd64 - -msg "calculating sha256sums" -sha256sum $frn-arm64*tar* > $SUITE-arm64/SHA256SUM -sha256sum $frn-armhf*tar* > $SUITE-armhf/SHA256SUM -sha256sum $frn-amd64*tar* > $SUITE-amd64/SHA256SUM - -shout "done" diff --git a/.github/workflows/build-udroid.yml b/.github/workflows/build-udroid.yml index 887a8d7..051e658 100644 --- a/.github/workflows/build-udroid.yml +++ b/.github/workflows/build-udroid.yml @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1d640eb..7314721 100755 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 @@ -26,8 +25,6 @@ here:
**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`: @@ -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 ( v1.0 ) @@ -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 diff --git a/build-kinetic.sh b/build-kinetic.sh deleted file mode 100755 index cd3ba55..0000000 --- a/build-kinetic.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env bash -#shellcheck disable=SC1091 - -# this is an example file to BUILD raw file system -# export variable SUITE to set debootstrap suite name (default: hirsute) - -source plugins/envsetup - -export OVERRIDER_COMPRESSION_TYPE -export SUITE -export ENABLE_EXIT -export ENABLE_USER_SETUP - -SUITE="kinetic" -frn="out/$SUITE-raw" -OVERRIDER_COMPRESSION_TYPE="gzip" -ENABLE_EXIT=true -ENABLE_USER_SETUP=false - -additional_setup() { -cat <<- EOF > $chroot_dir/etc/apt/sources.list -# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to -# newer versions of the distribution. -deb $MIRROR $SUITE main restricted -# deb-src $MIRROR $SUITE main restricted -## Major bug fix updates produced after the final release of the -## distribution. -deb $MIRROR $SUITE-updates main restricted -# deb-src $MIRROR $SUITE-updates main restricted -## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu -## team. Also, please note that software in universe WILL NOT receive any -## review or updates from the Ubuntu security team. -deb $MIRROR $SUITE universe -# deb-src $MIRROR $SUITE universe -deb $MIRROR $SUITE-updates universe -# deb-src $MIRROR $SUITE-updates universe -## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu -## team, and may not be under a free licence. Please satisfy yourself as to -## your rights to use the software. Also, please note that software in -## multiverse WILL NOT receive any review or updates from the Ubuntu -## security team. -deb $MIRROR $SUITE multiverse -# deb-src $MIRROR $SUITE multiverse -deb $MIRROR $SUITE-updates multiverse -# deb-src $MIRROR $SUITE-updates multiverse -## N.B. software from this repository may not have been tested as -## extensively as that contained in the main release, although it includes -## newer versions of some applications which may provide useful features. -## Also, please note that software in backports WILL NOT receive any review -## or updates from the Ubuntu security team. -deb $MIRROR $SUITE-backports main restricted universe multiverse -# deb-src $MIRROR $SUITE-backports main restricted universe multiverse -EOF - -# TODO: FOLLOW latest udroid version system ( Add props to /etc/os-release ) - -# set up pv -lshout "Setting up pv..." -cp $ROOT_DIR/core/pv/pv-${t_arch}.deb $chroot_dir -run_cmd "dpkg -i /pv-${t_arch}.deb" -run_cmd "rm /pv-${t_arch}.deb" - -} - -shout "Bootstrapping $SUITE...." -do_build "${frn}-arm64" arm64 -do_build "${frn}-armhf" armhf -do_build "${frn}-amd64" amd64 - -shout "packing up the raw file systems..." -do_compress "${frn}-arm64" -do_compress "${frn}-armhf" -do_compress "${frn}-amd64" - -shout "unmounting the raw file systems from host..." -do_unmount "${frn}-arm64" -do_unmount "${frn}-armhf" -do_unmount "${frn}-amd64" - -shout "Build Complete.." -ls ${frn}*tar* - diff --git a/plugins/envsetup b/plugins/envsetup index 4845b2f..564e759 100755 --- a/plugins/envsetup +++ b/plugins/envsetup @@ -24,7 +24,7 @@ # SOFTWARE. export ROOT_DIR -export BUILD_PALTFORM="linux" +export BUILD_PLATFORM="linux" _c_magneta="\e[95m" _c_green="\e[32m" @@ -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 @@ -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 @@ -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 @@ -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" ;; @@ -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 ( @@ -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 @@ -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" @@ -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 "$@" @@ -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 @@ -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 @@ -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 diff --git a/plugins/setup-user.sh b/plugins/setup-user.sh old mode 100644 new mode 100755 index df1dec6..42edc47 --- a/plugins/setup-user.sh +++ b/plugins/setup-user.sh @@ -1,14 +1,14 @@ -#!/usr/bin/env bash +#!/usr/bin/env bash -# username = FS_USER -# password = FS_PASS +# FS_USER = username +# FS_PASS = password useradd -m \ - -p "$(openssl passwd -1 FS_PASS)" \ + -p "$(openssl passwd -1 $FS_PASS)" \ -G sudo \ - -d /home/FS_USER \ + -d /home/$FS_USER \ -k /etc/skel \ -s /bin/bash \ - FS_USER -echo FS_USER ALL=\(root\) ALL > /etc/sudoers.d/FS_USER -chmod 0440 /etc/sudoers.d/FS_USER + $FS_USER +echo $FS_USER ALL=\(root\) ALL > /etc/sudoers.d/$FS_USER +chmod 0440 /etc/sudoers.d/$FS_USER diff --git a/plugins/zst-packer.sh b/plugins/zst-packer.sh old mode 100644 new mode 100755