mirror of
https://github.com/pentoo/pentoo-overlay
synced 2025-12-15 21:02:30 +01:00
magic-pax: initial commit
This commit is contained in:
parent
b959c43be6
commit
3a7b7e1293
2 changed files with 101 additions and 0 deletions
79
sys-apps/magic-pax/files/magic-pax
Executable file
79
sys-apps/magic-pax/files/magic-pax
Executable file
|
|
@ -0,0 +1,79 @@
|
|||
#!/bin/sh
|
||||
|
||||
#root check
|
||||
if [ -n "$(command -v id 2> /dev/null)" ]; then
|
||||
USERID="$(id -u 2> /dev/null)"
|
||||
fi
|
||||
if [ -z "${USERID}" ] && [ -n "$(id -ru)" ]; then
|
||||
USERID="$(id -ru)"
|
||||
fi
|
||||
if [ -n "${USERID}" ] && [ "${USERID}" != "0" ]; then
|
||||
printf "Run it as root\n" ; exit 1;
|
||||
elif [ -z "${USERID}" ]; then
|
||||
printf "Unable to determine user id, permission errors may occur.\n"
|
||||
fi
|
||||
|
||||
#usage check
|
||||
if [ -z "${1}" ] || [ -z "${2}" ]; then
|
||||
printf "Usage $(basename $0) <target file> <desired pax mark>\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#check target file
|
||||
if [ ! -w "${1}" ]; then
|
||||
printf "Target file ${1} is missing or we do not have write permissions...exiting.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#check pax marks
|
||||
#TODO support passing multiple pax marks one at a time
|
||||
|
||||
PAX_SETTING="$(portageq envvar PAX_MARKING)"
|
||||
if [ -z "${PAX_SETTING}" ]; then
|
||||
PAX_SETTING="PT"
|
||||
fi
|
||||
|
||||
if [ "${PAX_SETTING}" = "PT XT" ]; then
|
||||
PAX_SETTING="XT"
|
||||
fi
|
||||
|
||||
#if we got this far, we know what kind of marks portage thinks are valid.
|
||||
|
||||
if [ "${PAX_SETTING}" = "PT" ]; then
|
||||
paxctl-ng -L > /dev/null 2>&1
|
||||
if [ "$?" != "0" ];then
|
||||
printf "Portage seems to want PT_PAX but paxctl-ng reports it is not supported...exiting.\n"
|
||||
fi
|
||||
elif [ "${PAX_SETTING}" = "XT" ]; then
|
||||
paxctl-ng -l > /dev/null 2>&1
|
||||
if [ "$?" != "0" ];then
|
||||
printf "Portage seems to want XATTR_PAX but paxctl-ng reports it is not supported...exiting.\n"
|
||||
fi
|
||||
else
|
||||
printf "Unable to determine PAX setting...exiting.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#if we got this far, paxctl-ng thinks it supports whatever pax type we want
|
||||
|
||||
if [ "${PAX_SETTING}" = "PT" ]; then
|
||||
paxctl-ng -v "${1}" | grep PT_PAX | grep "${2}" -q
|
||||
if [ "$?" != "0" ]; then
|
||||
paxctl-ng -${2} ${1}
|
||||
paxctl-ng -v "${1}" | grep PT_PAX | grep "${2}" -q
|
||||
if [ "$?" != "0" ]; then
|
||||
printf "Failed to manipulate pt pax mark...exiting.\n"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
elif [ "${PAX_SETTING}" = "XT" ]; then
|
||||
paxctl-ng -v "${1}" | grep XATTR_PAX | grep "${2}" -q
|
||||
if [ "$?" != "0" ]; then
|
||||
paxctl-ng -${2} ${1}
|
||||
paxctl-ng -v "${1}" | grep XATTR_PAX | grep "${2}" -q
|
||||
if [ "$?" != "0" ]; then
|
||||
printf "Failed to manipulate xattr pax mark...exiting.\n"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
22
sys-apps/magic-pax/magic-pax-0.0.1.ebuild
Normal file
22
sys-apps/magic-pax/magic-pax-0.0.1.ebuild
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# Copyright 1999-2016 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Id$
|
||||
|
||||
EAPI=5
|
||||
|
||||
DESCRIPTION=""
|
||||
HOMEPAGE=""
|
||||
SRC_URI=""
|
||||
|
||||
LICENSE=""
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64"
|
||||
IUSE=""
|
||||
|
||||
DEPEND=""
|
||||
RDEPEND=""
|
||||
PDEPEND="sys-apps/elfix"
|
||||
|
||||
src_install() {
|
||||
dosbin "${FILESDIR}"/magic-pax
|
||||
}
|
||||
Loading…
Reference in a new issue