Add file type for generating packages
parent
ed1d8a013e
commit
4c48443809
35
aptpkg
35
aptpkg
|
@ -35,12 +35,45 @@ check(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Generate the debian control file
|
||||||
|
gen_control_file(){
|
||||||
|
mkdir -p "$builddir"/DEBIAN
|
||||||
|
echo "Package: $name
|
||||||
|
Version: $version-$rev
|
||||||
|
Architecture: amd64
|
||||||
|
Maintainer: $(grep -am 1 -hr "Maintainer: " build | sed 's/# Maintainer: //')
|
||||||
|
Homepage: $url
|
||||||
|
Description: $description
|
||||||
|
$customcontrol
|
||||||
|
" > "$builddir"/DEBIAN/control
|
||||||
|
}
|
||||||
|
|
||||||
# Download a debian package
|
# Download a debian package
|
||||||
build_deb(){
|
build_deb(){
|
||||||
echo "Getting $source"
|
echo "Getting $source"
|
||||||
wget "$source" -qO dist/"$name"_"$version"-"$rev"-amd64.deb
|
wget "$source" -qO dist/"$name"_"$version"-"$rev"-amd64.deb
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Download and build using files
|
||||||
|
build_file(){
|
||||||
|
builddir=${name}_${version}-${rev}_amd64
|
||||||
|
|
||||||
|
cd "$1"
|
||||||
|
mkdir -p "$builddir"
|
||||||
|
|
||||||
|
download "$@"
|
||||||
|
steps "$@"
|
||||||
|
|
||||||
|
gen_control_file "$@"
|
||||||
|
|
||||||
|
[ -f preinst ] && cp preinst "$builddir"/debian/
|
||||||
|
[ -f postinst ] && cp postinst "$builddir"/debian/
|
||||||
|
|
||||||
|
cd -
|
||||||
|
|
||||||
|
dpkg-deb --build --root-owner-group "$1"/"$builddir" dist/
|
||||||
|
}
|
||||||
|
|
||||||
# Determine which function to run
|
# Determine which function to run
|
||||||
load_build(){
|
load_build(){
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
|
@ -51,6 +84,8 @@ load_build(){
|
||||||
case "$type" in
|
case "$type" in
|
||||||
deb)
|
deb)
|
||||||
build_deb ;;
|
build_deb ;;
|
||||||
|
file)
|
||||||
|
build_file "$@" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue