165 lines
4.2 KiB
Diff
165 lines
4.2 KiB
Diff
diff -uNr pacman-6.0.0/scripts/makepkg.sh.in pacman-termux/scripts/makepkg.sh.in
|
|
--- pacman-6.0.0/scripts/makepkg.sh.in 2021-05-20 06:38:45.954786500 +0300
|
|
+++ pacman-termux/scripts/makepkg.sh.in 2021-10-04 16:00:39.000000000 +0300
|
|
@@ -26,7 +26,7 @@
|
|
|
|
# makepkg uses quite a few external programs during its execution. You
|
|
# need to have at least the following installed for makepkg to function:
|
|
-# awk, bsdtar (libarchive), bzip2, coreutils, fakeroot, file, find (findutils),
|
|
+# awk, bsdtar (libarchive), bzip2, coreutils, file, find (findutils),
|
|
# gettext, gpg, grep, gzip, sed, tput (ncurses), xz
|
|
|
|
# gettext initialization
|
|
@@ -59,7 +59,7 @@
|
|
GENINTEG=0
|
|
HOLDVER=0
|
|
IGNOREARCH=0
|
|
-INFAKEROOT=0
|
|
+PKGCREATION=0
|
|
INSTALL=0
|
|
LOGGING=0
|
|
NEEDED=0
|
|
@@ -105,7 +105,7 @@
|
|
trap_exit() {
|
|
local signal=$1; shift
|
|
|
|
- if (( ! INFAKEROOT )); then
|
|
+ if (( ! PKGCREATION )); then
|
|
echo
|
|
error "$@"
|
|
fi
|
|
@@ -123,7 +123,7 @@
|
|
clean_up() {
|
|
local EXIT_CODE=$?
|
|
|
|
- if (( INFAKEROOT )); then
|
|
+ if (( PKGCREATION )); then
|
|
# Don't clean up when leaving fakeroot, we're not done yet.
|
|
return 0
|
|
fi
|
|
@@ -179,9 +179,9 @@
|
|
fi
|
|
}
|
|
|
|
-enter_fakeroot() {
|
|
- msg "$(gettext "Entering %s environment...")" "fakeroot"
|
|
- fakeroot -- bash -$- "${BASH_SOURCE[0]}" -F "${ARGLIST[@]}" || exit $?
|
|
+pkg_creation() {
|
|
+ msg "$(gettext "Package creation...")"
|
|
+ "${BASH_SOURCE[0]}" -F "${ARGLIST[@]}" || exit $?
|
|
}
|
|
|
|
# Automatically update pkgver variable if a pkgver() function is provided
|
|
@@ -237,10 +237,6 @@
|
|
else
|
|
cmd=("${PACMAN_AUTH[@]}" "${cmd[@]}")
|
|
fi
|
|
- elif type -p sudo >/dev/null; then
|
|
- cmd=(sudo "${cmd[@]}")
|
|
- else
|
|
- cmd=(su root -c "$cmdescape")
|
|
fi
|
|
local lockfile="$(pacman-conf DBPath)/db.lck"
|
|
while [[ -f $lockfile ]]; do
|
|
@@ -597,7 +593,6 @@
|
|
merge_arch_attrs
|
|
|
|
printf "# Generated by makepkg %s\n" "$makepkg_version"
|
|
- printf "# using %s\n" "$(fakeroot -v)"
|
|
|
|
write_kv_pair "pkgname" "$pkgname"
|
|
write_kv_pair "pkgbase" "$pkgbase"
|
|
@@ -939,7 +934,7 @@
|
|
|
|
run_single_packaging() {
|
|
local pkgdir="$pkgdirbase/$pkgname"
|
|
- mkdir "$pkgdir"
|
|
+ mkdir -p "$terdir"
|
|
if [[ -n $1 ]] || (( PKGFUNC )); then
|
|
run_package $1
|
|
fi
|
|
@@ -1071,7 +1066,7 @@
|
|
-d|--nodeps) NODEPS=1 ;;
|
|
-e|--noextract) NOEXTRACT=1 ;;
|
|
-f|--force) FORCE=1 ;;
|
|
- -F) INFAKEROOT=1 ;;
|
|
+ -F) PKGCREATION=1 ;;
|
|
# generating integrity checks does not depend on architecture
|
|
-g|--geninteg) BUILDPKG=0 GENINTEG=1 IGNOREARCH=1;;
|
|
--holdver) HOLDVER=1 ;;
|
|
@@ -1186,17 +1181,10 @@
|
|
exit $E_FS_PERMISSIONS
|
|
fi
|
|
|
|
-if (( ! INFAKEROOT )); then
|
|
- if (( EUID == 0 )); then
|
|
- error "$(gettext "Running %s as root is not allowed as it can cause permanent,\n\
|
|
+if (( EUID == 0 )); then
|
|
+ error "$(gettext "Running %s as root is not allowed as it can cause permanent,\n\
|
|
catastrophic damage to your system.")" "makepkg"
|
|
- exit $E_ROOT
|
|
- fi
|
|
-else
|
|
- if [[ -z $FAKEROOTKEY ]]; then
|
|
- error "$(gettext "Do not use the %s option. This option is only for internal use by %s.")" "'-F'" "makepkg"
|
|
- exit $E_INVALID_OPTION
|
|
- fi
|
|
+ exit $E_ROOT
|
|
fi
|
|
|
|
unset pkgname "${pkgbuild_schema_strings[@]}" "${pkgbuild_schema_arrays[@]}"
|
|
@@ -1252,6 +1240,13 @@
|
|
# set pkgdir to something "sensible" for (not recommended) use during build()
|
|
pkgdir="$pkgdirbase/$pkgbase"
|
|
|
|
+# the second pkgdir but from the termux system directory
|
|
+terdir="$pkgdir/@TERMUX_BASE_DIR@"
|
|
+
|
|
+# adding home and prefix to compile correctly
|
|
+prefix="@TERMUX_PREFIX@"
|
|
+home="@TERMUX_HOME@"
|
|
+
|
|
if (( GENINTEG )); then
|
|
mkdir -p "$srcdir"
|
|
chmod a-s "$srcdir"
|
|
@@ -1320,10 +1315,10 @@
|
|
fi
|
|
|
|
# Run the bare minimum in fakeroot
|
|
-if (( INFAKEROOT )); then
|
|
+if (( PKGCREATION )); then
|
|
if (( SOURCEONLY )); then
|
|
create_srcpackage
|
|
- msg "$(gettext "Leaving %s environment.")" "fakeroot"
|
|
+ msg "$(gettext "Package creation.")"
|
|
exit $E_OK
|
|
fi
|
|
|
|
@@ -1338,7 +1333,7 @@
|
|
|
|
create_debug_package
|
|
|
|
- msg "$(gettext "Leaving %s environment.")" "fakeroot"
|
|
+ msg "$(gettext "Package creation.")"
|
|
exit $E_OK
|
|
fi
|
|
|
|
@@ -1365,7 +1360,7 @@
|
|
check_source_integrity all
|
|
cd_safe "$startdir"
|
|
|
|
- enter_fakeroot
|
|
+ pkg_creation
|
|
|
|
if [[ $SIGNPKG = 'y' ]]; then
|
|
msg "$(gettext "Signing package...")"
|
|
@@ -1467,7 +1462,7 @@
|
|
cd_safe "$startdir"
|
|
fi
|
|
|
|
- enter_fakeroot
|
|
+ pkg_creation
|
|
|
|
create_package_signatures || exit $E_PRETTY_BAD_PRIVACY
|
|
fi
|