Skip to content

Instantly share code, notes, and snippets.

@pauldotknopf
Last active July 27, 2020 04:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pauldotknopf/ff8e986225ab2f264acea1a5bb0c6c5a to your computer and use it in GitHub Desktop.
Save pauldotknopf/ff8e986225ab2f264acea1a5bb0c6c5a to your computer and use it in GitHub Desktop.
makepkg patch to run as root
diff --git a/makepkg-original b/makepkg
index 2fe769a..ec4963c 100755
--- a/makepkg-original
+++ b/makepkg
@@ -225,13 +225,6 @@ run_pacman() {
else
cmd=("$PACMAN_PATH" "$@")
fi
- if [[ $1 != -@(T|Q)*([[:alpha:]]) ]]; then
- if type -p sudo >/dev/null; then
- cmd=(sudo "${cmd[@]}")
- else
- cmd=(su root -c "$(printf '%q ' "${cmd[@]}")")
- fi
- fi
"${cmd[@]}"
}
@@ -990,13 +983,6 @@ check_software() {
fi
fi
- # check for sudo if we will need it during makepkg execution
- if (( DEP_BIN || RMDEPS || INSTALL )); then
- if ! type -p sudo >/dev/null; then
- warning "$(gettext "Cannot find the %s binary. Will use %s to acquire root privileges.")" "sudo" "su"
- fi
- fi
-
# fakeroot - correct package file permissions
if check_buildenv "fakeroot" "y" && (( EUID > 0 )); then
if ! type -p fakeroot >/dev/null; then
@@ -1400,19 +1386,6 @@ if (( LOGGING )) && ! ensure_writable_dir "LOGDEST" "$LOGDEST"; then
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\
-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
-fi
-
unset pkgname pkgbase pkgver pkgrel epoch pkgdesc url license groups provides
unset md5sums replaces depends conflicts backup source install changelog build
unset sha{1,224,256,384,512}sums makedepends optdepends options noextract validpgpkeys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment