-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from agnostic-apollo/rewrite
Rewrite termux-create-package
- Loading branch information
Showing
33 changed files
with
5,847 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Attach Files To Release | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: Set vars | ||
id: vars | ||
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//} | ||
- name: Clone repository | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ env.GITHUB_REF }} | ||
- name: sha256sums | ||
run: | | ||
cd ./src | ||
sha256sum termux-create-package > sha256sums.txt | ||
- name: Attach files to release | ||
env: | ||
RELEASE_TAG: ${{ steps.vars.outputs.tag }} | ||
run: >- | ||
hub release edit | ||
-m "" | ||
-a ./src/termux-create-package | ||
-a ./src/sha256sums.txt | ||
$RELEASE_TAG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
build/ | ||
dist/ | ||
*.egg-info | ||
*.deb | ||
src/__pycache__/ | ||
tests/__pycache__/ | ||
.pytest_cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
**Version Number Format:** `major.minor.patch` | ||
**Release Date Format:** `yyyy-mm-dd` | ||
|
||
**Types of Changes:** | ||
- **Added** for new features. | ||
- **Changed** for changes in existing functionality. | ||
- **Deprecated** for soon-to-be removed features. | ||
- **Removed** for now removed features. | ||
- **Fixed** for any bug fixes. | ||
- **Security** in case of vulnerabilities. | ||
## | ||
|
||
|
||
## [Unreleased] | ||
|
||
`-` | ||
|
||
|
||
## [v0.12.0] - 2022-01-08 | ||
|
||
### Added | ||
- Add support for `YAML` format for manifests. | ||
- Add support for custom permissions and ownership of data files. | ||
- Add support to automatically set permissions and ownership to control tar files. | ||
- Add support to automatically add `Installed-Size` field to `control` file. | ||
- Add support to automatically generate `md5sums` file. | ||
- Add support to automatically add other controls files `config`, `conffiles`, `templates`, `shlibs` to control tar. | ||
- Add support to add custom `control` file fields. | ||
- Add support for control and data tar compression type and format. | ||
- Add support for `--control-files-dir`, `--deb-dir`, `--deb-name`, `--files-dir`, `--pkg-arch`, `--pkg-version` and `--yaml` comamnd line options. | ||
- Add support of `installation_prefix`, `files_dir`, `tar_compression`, `tar_format`, `deb_dir`, `deb_name`, `deb_architecture_tag`, `control_files_dir`, `maintainer_scripts_shebang`, `conffiles_prefix_to_replace`, `fix_perms`, `allow_bad_user_names_and_ids`, `ignore_android_specific_rules` create info fields in manifest. | ||
- Add support of `source`, `perm`, `fix_perm`, `source_ownership`, `owner_uid`, `owner_uname`, `owner_gid`, `owner_gname`, `is_conffile` attribute fields for `data_files` dictionary in manifest. | ||
- Add support of `ignore`, `ignore_if_no_exist`, `source_readlink`, `source_recurse`, `set_parent_perm`, `symlink_destinations`, `set_shebang` action fields for `data_files` dictionary in manifest. | ||
- Add support to automatically add `termux-create-package` script and `sha256sums.txt` to releases. | ||
|
||
### Changed | ||
- The manifest format has been completely changed, but backward compatibility still maintained. Check `README.md` for details. The `files` dictionary has been replaced with `data_files`. The `control` file fields are to be added to the `control` dictionary. | ||
- Extended manifest validation so that debs comply with debian and `dpkg` rules. | ||
- The manifest `Depends`, `Provides`, `Conflicts` and other package relationship fields should be of type `string` now instead of a `list`. | ||
- The manifest `Description` and other multi-line field values should be of type `list` now instead of a `string`. | ||
- The `--prefix` must now be an absolute path. | ||
|
||
|
||
## [v0.11] - 2021-01-28 | ||
|
||
### Fixed | ||
- Fixed version in `setup.py`. ([`289ebc4f`](https://github.com/agnostic-apollo/termux-create-package/commit/289ebc4f)) | ||
|
||
|
||
## [v0.10] - 2020-07-11 | ||
|
||
### Changed | ||
|
||
- Minimized code structure and fixed minor issue | ||
|
||
|
||
## [v0.9] - 2020-07-08 | ||
|
||
### Added | ||
|
||
- Added support for manifest `suggests` and `recommends` fields. | ||
|
||
|
||
## [v0.8] - 2020-07-07 | ||
|
||
### Added | ||
|
||
- Added support to recursively add files to deb from source directories. | ||
|
||
### Fixed | ||
|
||
- Set default tar format to `tarfile.GNU_FORMAT` instead of `tarfile.PAX_FORMAT` to prevent corrupted package errors from `dpkg`. | ||
|
||
|
||
## [v0.7] - 2018-10-30 | ||
|
||
### Changed | ||
- Correct release number in setup.py. | ||
|
||
|
||
## [v0.6] - 2018-10-30 | ||
|
||
### Added | ||
- Allow for folders and symlinks in package ([`#15`](https://github.com/termux/termux-create-package/pull/15)). | ||
|
||
|
||
## [v0.5] - 2018-10-30 | ||
|
||
### Changed | ||
- Create `./control` instead of control in tar ([`#14`](https://github.com/termux/termux-create-package/pull/14)). | ||
|
||
|
||
## [v0.4] - 2017-03-19 | ||
|
||
### Added | ||
- Available for installation using pip. | ||
|
||
|
||
## [v0.3] - 2017-03-19 | ||
|
||
### Added | ||
- Add support for the `--prefix` option. | ||
|
||
|
||
## [v0.2] - 2016-12-11 | ||
|
||
### Added | ||
|
||
- Add support for `Conflicts`, `Homepage` and `Provides` fields. | ||
## | ||
|
||
|
||
[unreleased]: https://github.com/termux/termux-create-package/compare/v0.12.0...HEAD | ||
[v0.12.0]: https://github.com/termux/termux-create-package/compare/v0.11...v0.12.0 | ||
[v0.11]: https://github.com/termux/termux-create-package/compare/v0.10...v0.11 | ||
[v0.10]: https://github.com/termux/termux-create-package/compare/v0.9...v0.10 | ||
[v0.9]: https://github.com/termux/termux-create-package/compare/v0.8...v0.9 | ||
[v0.8]: https://github.com/termux/termux-create-package/compare/v0.7...v0.8 | ||
[v0.7]: https://github.com/termux/termux-create-package/releases/tag/v0.7 | ||
[v0.6]: https://github.com/termux/termux-create-package/releases/tag/v0.6 | ||
[v0.5]: https://github.com/termux/termux-create-package/releases/tag/v0.5 | ||
[v0.4]: https://github.com/termux/termux-create-package/releases/tag/v0.4 | ||
[v0.3]: https://github.com/termux/termux-create-package/releases/tag/v0.3 | ||
[v0.2]: https://github.com/termux/termux-create-package/releases/tag/v0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
# Installation | ||
|
||
### Contents | ||
- [Dependencies](#Dependencies) | ||
- [Termux In Android Installation From Repository](#Termux-In-Android-Installation-From-Repository) | ||
- [Termux In Android Installation From Source](#Termux-In-Android-Installation-From-Source) | ||
- [Linux Distros System Installation From Repository](#Linux-Distros-System-Installation-From-Repository) | ||
- [Linux Distros System Installation From Source](#Linux-Distros-System-Installation-From-Source) | ||
## | ||
|
||
|
||
### Dependencies | ||
|
||
- Android users should install [Termux App](https://github.com/termux/termux-app). | ||
|
||
- `python3` and optionally `pip3` should be installed in your system. | ||
- Termux (non-root shell): `pkg install python`. Check https://wiki.termux.com/wiki/Python for details. `pip` will automatically be installed. | ||
- Linux distros: `sudo apt install python3 python3-pip`. | ||
|
||
- The [`ruamel.yaml`](https://yaml.readthedocs.io) python module is used to load `YAML` manifest files. Check [Install](https://yaml.readthedocs.io/en/latest/install.html) instructions for more info. | ||
- Termux (non-root shell): `pip install ruamel.yaml`. | ||
- Linux distros: `sudo pip3 install ruamel.yaml`. | ||
## | ||
|
||
|
||
|
||
### Termux In Android Installation From Repository | ||
|
||
``` | ||
pkg install termux-create-package | ||
``` | ||
## | ||
|
||
|
||
|
||
### Termux In Android Installation From Source | ||
|
||
The `termux-create-package` file should be installed in termux `bin` directory `/data/data/com.termux/files/usr/bin`. | ||
It should have `termux` `uid:gid` ownership and have readable `700` permission before it can be sourced. | ||
|
||
#### Basic | ||
|
||
``` | ||
pkg install curl && \ | ||
export install_path="/data/data/com.termux/files/usr/bin" && \ | ||
mkdir -p "$install_path" && \ | ||
curl -L 'https://github.com/termux/termux-create-package/releases/latest/download/termux-create-package' -o "$install_path/termux-create-package" && \ | ||
export owner="$(stat -c "%u" "$install_path")"; chown "$owner:$owner" "$install_path/termux-create-package" && \ | ||
chmod 700 "$install_path/termux-create-package"; | ||
``` | ||
|
||
#### Advance | ||
|
||
1. Export install directory path and create it. | ||
|
||
``` | ||
export install_path="/data/data/com.termux/files/usr/bin" | ||
mkdir -p "$install_path" | ||
``` | ||
|
||
2. Download the `termux-create-package` file. | ||
|
||
- Download to install directory directly from github using `curl` using a non-root termux shell. | ||
Run `pkg install curl` to install `curl` first. | ||
- Latest release: | ||
|
||
`curl -L 'https://github.com/termux/termux-create-package/releases/latest/download/termux-create-package' -o "$install_path/termux-create-package"` | ||
|
||
- Specific release: | ||
|
||
`curl -L 'https://github.com/termux/termux-create-package/releases/download/v0.12.0/termux-create-package' -o "$install_path/termux-create-package"` | ||
|
||
- Master Branch *may be unstable*: | ||
|
||
`curl -L 'https://github.com/termux/termux-create-package/raw/master/src/termux-create-package' -o "$install_path/termux-create-package"` | ||
|
||
- Download `termux-create-package` file manually from github to the android download directory and then copy it to install directory. | ||
|
||
You can download the `termux-create-package` file from a github release from the `Assets` dropdown menu. | ||
|
||
You can also download it from a specific github branch/tag by opening the [`termux-create-package`](./src/termux-create-package) file from the `Code` section. | ||
Right-click or hold the `Raw` button at the top and select `Download/Save link`. | ||
|
||
Then copy the file to install directory using `cat` command below or use a root file browser to manually place it. | ||
|
||
`cat "/storage/emulated/0/Download/termux-create-package" > "$install_path/termux-create-package"` | ||
|
||
3. Set `termux` ownership and readable permissions. | ||
|
||
- If you used a `curl` or `cat` to copy the file, then use a non-root termux shell to set ownership and permissions with `chown` and `chmod` commands respectively: | ||
|
||
`export owner="$(stat -c "%u" "$install_path")"; chown "$owner:$owner" "$install_path/termux-create-package" && chmod 700 "$install_path/termux-create-package";` | ||
|
||
- If you used a root file browser to copy the file, then use `su` to start a root shell to set ownership and permissions with `chown` and `chmod` commands respectively: | ||
|
||
`export owner="$(stat -c "%u" "$install_path")"; su -c "chown \"$owner:$owner\" \"$install_path/termux-create-package\" && chmod 700 \"$install_path/termux-create-package\"";` | ||
|
||
- Or manually set them with your root file browser. You can find `termux` `uid` and `gid` by running the command `id -u` in a non-root termux shell or by checking the properties of the termux `bin` directory from your root file browser. | ||
## | ||
|
||
|
||
|
||
|
||
|
||
### Linux Distros System Installation From Repository | ||
|
||
``` | ||
sudo pip3 install termux-create-package | ||
``` | ||
## | ||
|
||
|
||
|
||
### Linux Distros System Installation From Source | ||
|
||
The `termux-create-package` file should be placed in the `/usr/local/bin` directory if you want to install it system-wide for all users as per [FHS 3.0](https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s09.html). | ||
It should have readable `755` permission before it can be sourced. | ||
|
||
The install command for `curl` is for Ubuntu/Debian, it may be different for other distros. | ||
|
||
#### Basic | ||
|
||
``` | ||
sudo apt install curl && \ | ||
export install_path="/usr/local/bin" && \ | ||
sudo mkdir -p "$install_path" && \ | ||
sudo curl -L 'https://github.com/termux/termux-create-package/releases/latest/download/termux-create-package' -o "$install_path/termux-create-package" && \ | ||
sudo chmod 755 "$install_path/termux-create-package"; | ||
``` | ||
|
||
#### Advance | ||
|
||
1. Export install directory path and create it. | ||
|
||
``` | ||
export install_path="/usr/local/bin" | ||
mkdir -p "$install_path" | ||
``` | ||
|
||
2. Download the `termux-create-package` file. | ||
|
||
- Download to install directory directly from github using `curl` using a root shell with `sudo`. | ||
Run `sudo apt install curl` to install `curl` first. | ||
|
||
- Latest release: | ||
|
||
`sudo curl -L 'https://github.com/termux/termux-create-package/releases/latest/download/termux-create-package' -o "$install_path/termux-create-package"` | ||
|
||
- Specific release: | ||
|
||
`sudo curl -L 'https://github.com/termux/termux-create-package/releases/download/v0.12.0/termux-create-package' -o "$install_path/termux-create-package"` | ||
|
||
- Master Branch *may be unstable*: | ||
|
||
`sudo curl -L 'https://github.com/termux/termux-create-package/raw/master/src/termux-create-package' -o "$install_path/termux-create-package"` | ||
|
||
- Download `termux-create-package` file manually from github to the install directory. | ||
|
||
You can download the `termux-create-package` file from a github release from the `Assets` dropdown menu. | ||
|
||
You can also download it from a specific github branch/tag by opening the [`termux-create-package`](./src/termux-create-package) file from the `Code` section. | ||
Right-click or hold the `Raw` button at the top and select `Download/Save link`. | ||
|
||
Then copy the file to install directory using `cat` command below or use a root file browser to manually place it (`sudo nautilus`). | ||
|
||
`sudo cat "termux-create-package" > "$install_path/termux-create-package"` | ||
|
||
3. Set readable permissions. | ||
|
||
- Set ownership and permissions with `chown` and `chmod` commands respectively: | ||
|
||
`sudo chmod 755 "$install_path/termux-create-package"` | ||
## |
Oops, something went wrong.