Skip to content

Commit

Permalink
optimized
Browse files Browse the repository at this point in the history
  • Loading branch information
leleliu008 committed Nov 25, 2024
1 parent 9bd55af commit 4d826b3
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/chroot-alpinelinux.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: chroot AlpineLinux
name: chroot/AlpineLinux

on:
push:
Expand Down
110 changes: 110 additions & 0 deletions .github/workflows/chroot-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: chroot/Ubuntu

on:
push:
branches: [ master, dev ]
pull_request:
branches: [ master, dev ]

jobs:
test:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- run: curl -LO https://cdimage.ubuntu.com/ubuntu-base/releases/24.04/release/ubuntu-base-24.04.1-base-amd64.tar.gz
- run: install -d ubuntu-rootfs
- run: tar xf ubuntu-base-24.04.1-base-amd64.tar.gz -C ubuntu-rootfs
- run: cp -p /etc/resolv.conf ubuntu-rootfs/etc/
- run: mv ndk-pkg ubuntu-rootfs/bin/

- run: sudo mount -o bind /dev ubuntu-rootfs/dev
- run: sudo mount -t proc none ubuntu-rootfs/proc
- run: sudo mount -t sysfs none ubuntu-rootfs/sys
- run: sudo mount -t tmpfs none ubuntu-rootfs/tmp

- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg --help
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg -h

- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg --version
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg -V

- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg about

- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg setup -y

- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg sysinfo


- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg integrate zsh

- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg update

- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg search lib
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg search libzip


- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-available libzip
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-available libzip --yaml
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-available libzip --json
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-available libzip version
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-available libzip license
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-available libzip summary
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-available libzip web-url
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-available libzip git-url
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-available libzip git-sha
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-available libzip git-ref
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-available libzip src-url
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-available libzip src-sha




- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg depends libzip
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg depends libzip -t dot
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg depends libzip -t box
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg depends libzip -t dot -o a/
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg depends libzip -o libzip.box


- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg install libzip


- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-installed libzip --prefix
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-installed libzip --files
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-installed libzip version
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-installed libzip builtat
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-installed libzip builtat-iso-8601
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-installed libzip builtat-rfc-3339
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-installed libzip builtat-iso-8601-utc
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg info-installed libzip builtat-rfc-3339-utc


- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg tree libzip
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg tree libzip -a

- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg pack libzip
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg pack libzip -t tar.gz
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg pack libzip -t tar.xz
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg pack libzip -t tar.xz -o .
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg pack libzip -o .
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg pack libzip -o xx.tar.xz


- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg formula-repo-list

- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg ls-available
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg ls-installed
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg ls-outdated

- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg is-available libzip
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg is-installed libzip
- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg is-outdated libzip || echo "not outdated"

- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg uninstall libzip

- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg fetch curl

- run: sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg upgrade-self
37 changes: 31 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,42 @@ docker exec -it ndk-pkg ndk-pkg install curl --target=android-35-arm64-v8a --sta

**Note:** you can use `podman` instead of `docker`

## Using ndk-pkg via chroot
## Using ndk-pkg via chroot+ubuntu

This is the recommended way of using this software if you want to use this software locally and your host is `linux-x86_64`.

`chroot` likes `docker` container is an isolated clean environment where the running process can not be affected by your host system's environemt variables.

```bash
curl -LO http://dl-cdn.alpinelinux.org/alpine/v3.20/releases/x86_64/alpine-minirootfs-3.20.3-x86_64.tar.gz
curl -LO https://cdimage.ubuntu.com/ubuntu-base/releases/24.04/release/ubuntu-base-24.04.1-base-amd64.tar.gz
install -d ubuntu-rootfs
tar xf ubuntu-base-24.04.1-base-amd64.tar.gz -C ubuntu-rootfs

install -d alpine-rootfs
cp -p /etc/resolv.conf alpine-rootfs/etc/

curl -LO https://raw.githubusercontent.com/leleliu008/ndk-pkg/master/ndk-pkg
chmod a+x ndk-pkg
mv ndk-pkg ubuntu-rootfs/bin/

sudo mount -o bind /dev ubuntu-rootfs/dev
sudo mount -t proc none ubuntu-rootfs/proc
sudo mount -t sysfs none ubuntu-rootfs/sys
sudo mount -t tmpfs none ubuntu-rootfs/tmp

sudo chroot ubuntu-rootfs env GITHUB_ACTIONS=true ndk-pkg setup
sudo chroot ubuntu-rootfs env GITHUB_ACTIONS=true ndk-pkg update
sudo chroot ubuntu-rootfs env GITHUB_ACTIONS=true ndk-pkg install curl --target=android-35-arm64-v8a --static
```

## Using ndk-pkg via chroot+alpine

This is the recommended way of using this software if you want to use this software locally and your host is `linux-x86_64`.

`chroot` likes `docker` container is an isolated clean environment where the running process can not be affected by your host system's environemt variables.

```bash
curl -LO http://dl-cdn.alpinelinux.org/alpine/v3.20/releases/x86_64/alpine-minirootfs-3.20.3-x86_64.tar.gz
install -d alpine-rootfs
tar xf alpine-minirootfs-3.20.3-x86_64.tar.gz -C alpine-rootfs

cp -p /etc/resolv.conf alpine-rootfs/etc/
Expand All @@ -117,9 +142,9 @@ sudo mount -t sysfs none alpine-rootfs/sys
sudo chroot alpine-rootfs apk update
sudo chroot alpine-rootfs apk add gcompat

sudo chroot alpine-rootfs ndk-pkg setup
sudo chroot alpine-rootfs ndk-pkg update
sudo chroot alpine-rootfs ndk-pkg install curl --target=android-35-arm64-v8a --static
sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg setup
sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg update
sudo chroot alpine-rootfs env GITHUB_ACTIONS=true ndk-pkg install curl --target=android-35-arm64-v8a --static
```

## Using ndk-pkg via [WSL](https://docs.microsoft.com/en-us/windows/wsl)
Expand Down

0 comments on commit 4d826b3

Please sign in to comment.