update: better version and empty root directory checking for mp-build and mp-check
This commit is contained in:
parent
4cee462e70
commit
ec9781a5b6
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
|||||||
SUBDIRS := $(wildcard */.)
|
SUBDIRS := $(wildcard */.)
|
||||||
VERSION = 24.07
|
VERSION = 24.08
|
||||||
|
|
||||||
install:
|
install:
|
||||||
@for dir in $(SUBDIRS) ; do \
|
@for dir in $(SUBDIRS) ; do \
|
||||||
|
@ -110,7 +110,7 @@ clean_dist() {
|
|||||||
rm -f "${distpath}/files.tar.gz"
|
rm -f "${distpath}/files.tar.gz"
|
||||||
}
|
}
|
||||||
|
|
||||||
# install a list of packages with matt
|
# install a list of packages with matt
|
||||||
matt_install(){
|
matt_install(){
|
||||||
if [ "$EUID" -ne 0 ]; then
|
if [ "$EUID" -ne 0 ]; then
|
||||||
if type doas > /dev/null; then
|
if type doas > /dev/null; then
|
||||||
@ -122,7 +122,7 @@ matt_install(){
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$DOAS matt install --yes --skip --ignore-none $@
|
$DOAS matt install --yes --skip --ignore-none $@
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
@ -421,6 +421,11 @@ mkdir -p "${distpath}"
|
|||||||
clean_dist
|
clean_dist
|
||||||
|
|
||||||
# build the files archive
|
# build the files archive
|
||||||
|
if [ -z "$(ls -A)" ]; then
|
||||||
|
error "Root directory is empty, did something went wrong during build?"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
find . -printf "%P\n" | fakeroot tar -czf "${distpath}/files.tar.gz" --no-recursion -T -
|
find . -printf "%P\n" | fakeroot tar -czf "${distpath}/files.tar.gz" --no-recursion -T -
|
||||||
check_ret "(1/6) Failed to create the files archive (files.tar.gz)"
|
check_ret "(1/6) Failed to create the files archive (files.tar.gz)"
|
||||||
success "(1/6) Created the files archive (files.tar.gz)"
|
success "(1/6) Created the files archive (files.tar.gz)"
|
||||||
|
@ -174,6 +174,26 @@ check_archive(){
|
|||||||
fail_check
|
fail_check
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${k}" == "size" ]; then
|
||||||
|
if [ ! -z "${line_1}" ]; then
|
||||||
|
size="$(echo "${line_1}" | sed 's/size= //g')"
|
||||||
|
size="$(echo "${size}" | sed 's/size=//g')"
|
||||||
|
else
|
||||||
|
size="$(echo "${line_2}" | sed 's/size = //g')"
|
||||||
|
size="$(echo "${size}" | sed 's/size =//g')"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${size}" ]; then
|
||||||
|
error "Failed to obtain package size information"
|
||||||
|
fail_check
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${size}" == "0" ]; then
|
||||||
|
error "Package size information is set as 0, is the package empty?"
|
||||||
|
fail_check
|
||||||
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
name="$(head -n1 "${tmpdir}/DATA" | sed 's/\[//g')"
|
name="$(head -n1 "${tmpdir}/DATA" | sed 's/\[//g')"
|
||||||
@ -184,6 +204,24 @@ check_archive(){
|
|||||||
fail_check
|
fail_check
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case "${name}" in
|
||||||
|
*_*)
|
||||||
|
error "Package name contains an invalid character: \"_\""
|
||||||
|
fail_check ;;
|
||||||
|
*" "*)
|
||||||
|
error "Package name contains an invalid character: \" \""
|
||||||
|
fail_check ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "${version}" in
|
||||||
|
*_*)
|
||||||
|
error "Package version contains an invalid character: \"_\""
|
||||||
|
fail_check ;;
|
||||||
|
*" "*)
|
||||||
|
error "Package version contains an invalid character: \" \""
|
||||||
|
fail_check ;;
|
||||||
|
esac
|
||||||
|
|
||||||
filename="${name}_${version}.mpf"
|
filename="${name}_${version}.mpf"
|
||||||
|
|
||||||
info "Checking HASHES file"
|
info "Checking HASHES file"
|
||||||
@ -208,8 +246,15 @@ check_archive(){
|
|||||||
done < "${tmpdir}/HASHES"
|
done < "${tmpdir}/HASHES"
|
||||||
|
|
||||||
info "Checking files.tar.gz archive"
|
info "Checking files.tar.gz archive"
|
||||||
|
filec=0
|
||||||
|
|
||||||
while read p; do
|
while read p; do
|
||||||
|
if [ -z "${p}" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
filec=$((filec + 1))
|
||||||
|
|
||||||
if [ "${p:0:1}" == "." ] || [ "${p:0:1}" == "/" ]; then
|
if [ "${p:0:1}" == "." ] || [ "${p:0:1}" == "/" ]; then
|
||||||
error "Root file location is invalid (${p:0:1})"
|
error "Root file location is invalid (${p:0:1})"
|
||||||
fail_check
|
fail_check
|
||||||
@ -231,6 +276,11 @@ check_archive(){
|
|||||||
fi
|
fi
|
||||||
done < <(tar tf "${tmpdir}/files.tar.gz")
|
done < <(tar tf "${tmpdir}/files.tar.gz")
|
||||||
|
|
||||||
|
if [ "${filec}" == "0" ]; then
|
||||||
|
error "Package file archive is empty (no files)"
|
||||||
|
fail_check
|
||||||
|
fi
|
||||||
|
|
||||||
info "Checking INSTALL file"
|
info "Checking INSTALL file"
|
||||||
|
|
||||||
if [ -f "${tmpdir}/INSTALL" ] && ! grep -q . "${tmpdir}/INSTALL"; then
|
if [ -f "${tmpdir}/INSTALL" ] && ! grep -q . "${tmpdir}/INSTALL"; then
|
||||||
|
@ -228,6 +228,17 @@ check_pkg_vars() {
|
|||||||
return 1 ;;
|
return 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
case "${VERSION}" in
|
||||||
|
*_*)
|
||||||
|
error "Package version contains an invalid character: \"_\""
|
||||||
|
unset_indent
|
||||||
|
return 1 ;;
|
||||||
|
*" "*)
|
||||||
|
error "Package version contains an invalid character: \" \""
|
||||||
|
unset_indent
|
||||||
|
return 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user