added pmbuild

This commit is contained in:
wt committed 2025-01-20 18:45:13 +07:00
1 parent feded5e14e
commit fc2d7e7915
3 files changed
+73 -7

No files matched your search

+2 -2
View File
@@ -4,7 +4,7 @@ DESTDIR=/
install: install:
if [ ! -d ${DESTDIR}/etc/pm ]; then \ if [ ! -d ${DESTDIR}/etc/pm ]; then \
mkdir -pv ${DESTDIR}/etc/pm; \ mkdir -pv ${DESTDIR}/etc/pm; \
touch ${DESTDIR}/etc/pm/repo; \ # touch ${DESTDIR}/etc/pm/repo; \
fi fi
if [ ! -d ${DESTDIR}/tmp ]; then \ if [ ! -d ${DESTDIR}/tmp ]; then \
mkdir -pv ${DESTDIR}/tmp; \ mkdir -pv ${DESTDIR}/tmp; \
@@ -14,7 +14,7 @@ install:
fi fi
if [ ! -d ${DESTDIR}/usr/share/pm ]; then \ if [ ! -d ${DESTDIR}/usr/share/pm ]; then \
mkdir -pv ${DESTDIR}/usr/share/pm/{packages,repos}; \ mkdir -pv ${DESTDIR}/usr/share/pm/{packages,repos}; \
touch ${DESTDIR}/usr/share/pm/query; \ # touch ${DESTDIR}/usr/share/pm/query; \
fi fi
if [ ! -d ${DESTDIR}/var/cache/pm/pkg ]; then \ if [ ! -d ${DESTDIR}/var/cache/pm/pkg ]; then \
mkdir -pv ${DESTDIR}/var/cache/pm/pkg; \ mkdir -pv ${DESTDIR}/var/cache/pm/pkg; \
+11
View File
@@ -0,0 +1,11 @@
pkgname=pm
pkgver=1.1
pkgrel=1
# srcdir=/home/tola/Documents/linux/pm
gitsource="https://gitea.home.com:3000/TolaMironcenko/pm.git"
deps="busybox"
package() {
cd $srcdir
make install DESTDIR=$pkgdir
}
+60 -5
View File
@@ -107,6 +107,7 @@ down() {
if [[ $j == $1 ]]; then if [[ $j == $1 ]]; then
if [ ! -f $cachedpkgdir/$1.pkg.gz ]; then if [ ! -f $cachedpkgdir/$1.pkg.gz ]; then
printf "$YELLOW**$RESET Downloading $YELLOW$serverdir: $Bwhite$j\n$RESET" printf "$YELLOW**$RESET Downloading $YELLOW$serverdir: $Bwhite$j\n$RESET"
echo $i/$1.pkg.gz
wget $i/$1.pkg.gz -P $cachedpkgdir wget $i/$1.pkg.gz -P $cachedpkgdir
check $? "Download package" check $? "Download package"
# if [[ "$?" == "0" ]]; then # if [[ "$?" == "0" ]]; then
@@ -328,22 +329,23 @@ search() {
done done
exit 0 exit 0
fi fi
found=false
for i in $servers; do for i in $servers; do
serverdir=$(echo $i | sed -e "/http:\/\//s///") serverdir=$(echo $i | sed -e "/http:\/\//s///")
serverdir=$(echo $serverdir | sed -e "/ftp:\/\//s///") serverdir=$(echo $serverdir | sed -e "/ftp:\/\//s///")
repoquery=$(/usr/bin/cat $reposquerydir/$serverdir/query | sed -e '/.pkg.gz/s///') repoquery=$(/usr/bin/cat $reposquerydir/$serverdir/query | sed -e '/.pkg.gz/s///')
for j in $repoquery; do for j in $repoquery; do
if [[ $j == $1 ]]; then if [[ $j =~ $1 ]]; then
printf "$YELLOW$serverdir: $BWHITE$j\n$RESET" printf "$YELLOW$serverdir: $BWHITE$j\n$RESET"
exit 0 # exit 0
found=true
fi fi
done done
done done
printf "$YELLOW**$RED error:$RESET can't find package ($1)\n" [ "$found" = "false" ] && printf "$YELLOW**$RED error:$RESET can't find package ($1)\n"
} }
ss() { ss() {
search search $1
} }
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@@ -365,6 +367,56 @@ deps() {
cat $installedpackagesdir/$1.pkg/deps cat $installedpackagesdir/$1.pkg/deps
} }
buildpkg() {
if [ ! -f ./PMBUILD ]; then
if [ "$1" != "" ]; then
source $1
else
printf "$BBLUE**$BWHITE Can't find PMBUILD [$BRED ERROR $BWHITE]\n$RESET"
fi
else
source ./PMBUILD
fi
[ ! -d src ] && mkdir -pv src
[ ! -d pkg/$pkgname-$pkgver-$pkgrel.pkg ] && mkdir -pv pkg/$pkgname-$pkgver-$pkgrel.pkg
export buildroot=$(pwd)
export pkgdir=$buildroot/pkg/$pkgname-$pkgver-$pkgrel.pkg
if [ "$srcdir" = "" ]; then
export srcdir=$buildroot/src/$pkgname
fi
echo $pkgdir
echo $srcdir
if [ "$gitsource" != "" ]; then
echo $gitsource
git clone $gitsource $srcdir
fi
if [[ $(type -t build) = function ]]; then
echo "yes"
else
echo "no"
fi
if [[ $(type -t package) == function ]]; then
echo "yes"
package
else
echo "no"
fi
cd $pkgdir
find -type f > $buildroot/list
sed -i "s/.\///" $buildroot/list
cd $buildroot
mv -v list $pkgdir/list
if [ "$deps" != "" ]; then
for i in $deps; do
echo $i >> $pkgdir/deps
done
fi
cd $pkgdir
tar -czvf $buildroot/$pkgname-$pkgver-$pkgrel.pkg.gz ..
cd $buildroot
unset pkgdir srcdir buildroot
}
case "$1" in case "$1" in
add|a|del|d) add|a|del|d)
checkroot checkroot
@@ -374,6 +426,9 @@ case "$1" in
checkroot checkroot
"$1" $2 "$1" $2
;; ;;
build)
buildpkg $2
;;
*) *)
help help
;; ;;