refactor example DEBBUILD, add LICENSE and README
This commit is contained in:
parent
34537bd30b
commit
20272db3d8
51
DEBBUILD
51
DEBBUILD
|
@ -1,32 +1,57 @@
|
||||||
#/usr/bin/env bash
|
#/usr/bin/env bash
|
||||||
|
|
||||||
pkgname="forgejo"
|
pkgname="makedeb"
|
||||||
pkgver=23333 # this will be override by pkgver function
|
pkgver=0.0.1.0.g34537bd
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgcommit=""
|
pkgcommit=""
|
||||||
pkgdesc="A painless selfhost git service."
|
pkgdesc="A painless selfhost git service."
|
||||||
url="https://codeberg.org/forgejo/forgejo"
|
url="https://git.leafee98.com/leafee98/makedeb"
|
||||||
maintainer="Leafee98 <me@leafee98.com>"
|
maintainer="Leafee98 <me@leafee98.com>"
|
||||||
|
|
||||||
source=(
|
source=(
|
||||||
"forgejo-1.19.0-2-linux-amd64.xz::https://codeberg.org/attachments/5f7f9d36-b85e-40db-b390-9bf39acbbbc5"
|
"LICENSE::https://git.leafee98.com/leafee98/makedeb/raw/branch/main/LICENSE" # from http
|
||||||
"bwifi::git+https://cgit.leafee98.com/bwifi.git/#commit=8af4243f622bcb52f2e5be3345e282fd7cbad4d0"
|
"makedeb-repo::git+https://git.leafee98.com/leafee98/makedeb.git#branch=main" # from git with https
|
||||||
"frp-0.46.1.tar.gz::material/frp-0.46.1.tar.gz"
|
"README.md::README.md" # from local file
|
||||||
"pkg.zip::material/pkg.zip"
|
|
||||||
"t.sh::material/t.sh"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# This will be run just follow extracting source
|
# This will be run just after extracting source, and re-assign to `pkgver`
|
||||||
|
#
|
||||||
|
# If extracting version from source is not needed, don't define this function.
|
||||||
function pkgver {
|
function pkgver {
|
||||||
echo "1.19.0-2"
|
git describe --tags --long | sed 's/^v//;s/-/./g'
|
||||||
}
|
}
|
||||||
|
|
||||||
function build {
|
function build {
|
||||||
install -D "${srcdir}/t.sh" "${pkgdir}/usr/bin/t.sh"
|
echo "Here should do something like compile sources."
|
||||||
echo "building"
|
echo "But for this package we just print some messages."
|
||||||
}
|
}
|
||||||
|
|
||||||
function package {
|
function package {
|
||||||
echo "installing package, pkgdir: ${pkgdir}"
|
install -Dm644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/makedeb/LICENSE"
|
||||||
|
install -Dm755 "${srcdir}/makedeb-repo/makedeb" "${pkgdir}/usr/bin/makedeb"
|
||||||
|
install -Dm755 "${srcdir}/README.md" "${pkgdir}/usr/share/doc/makedeb/README.md"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# The function describing hook for (pre|post)(inst|rm) should
|
||||||
|
# *print* content of those hook file.
|
||||||
|
# If the any hook is not needed, don't define those function.
|
||||||
|
|
||||||
|
#function debian_preinst {
|
||||||
|
#}
|
||||||
|
|
||||||
|
function debian_postinst {
|
||||||
|
cat << EOF
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
echo "successfully installed makedeb"
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
#function debian_prerm {
|
||||||
|
#}
|
||||||
|
|
||||||
|
function debian_postrm {
|
||||||
|
cat << EOF
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
echo "successfully removed makedeb"
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
22
LICENSE
Normal file
22
LICENSE
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 Leafee98
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
33
README.md
Normal file
33
README.md
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# makedeb
|
||||||
|
|
||||||
|
Script for building Debian package quickly and easily. Inspired by Archlinux's makepkg.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
Check the `DEBBUILD`
|
||||||
|
|
||||||
|
## Reference
|
||||||
|
|
||||||
|
### Build process
|
||||||
|
|
||||||
|
First it download needed content from array `sources`, then use function `pkgver` to determine the package version, then run function `build` and function `package`, then run hooks `debian_(pre|post)(inst|rm)` and make the printed strings as debian's hook scripts. Finally generate .deb with files in `$pkgdir`.
|
||||||
|
|
||||||
|
### Download and extract source
|
||||||
|
|
||||||
|
Every string in array `source` should be like `<actual_file_name>::<download_url>`. When downloading, the `download_url` content will be named with `<actual_file_name>`. When `build` and `pacage` run, every `<actual_file_name>` will be copied to `$srcdir`. If the file is a compressed file, it will be decompressed, if the file is a git repo, the specific branch, commit or tag will be checkouted.
|
||||||
|
|
||||||
|
### Global variables
|
||||||
|
|
||||||
|
- `pkgname`: package's name
|
||||||
|
- `pkgver`: package's version, if need to extract version from source, use function `pkgver`
|
||||||
|
- `pkgrel`: debian package reference, it should increase by one every build
|
||||||
|
- `pkgdesc`: package's description
|
||||||
|
- `url`: packages upstream url
|
||||||
|
- `maintainer`: maintainer's contect information
|
||||||
|
|
||||||
|
### Global functions
|
||||||
|
|
||||||
|
- `pkgver`: should print the actual version. This override the variable `pkgver`
|
||||||
|
- `build`: do something like compile source
|
||||||
|
- `package`: do something like copy file from `$srcdir` to `$pkgdir`
|
||||||
|
- `debian_(pre|post)(inst|rm)`: should print content of debian hooks file
|
Loading…
Reference in a new issue