CommonInstaller, CommonAddon: update detect_outfd

merge-requests/23/head
Christopher Roy Bratusek 6 years ago
parent 1c8c5d1291
commit b117c4fd48

@ -15,6 +15,7 @@
. /tmp/backuptool.functions
MODID=@MODID@
OUTFD=
GOOGLE_APPS="AMAPNetworkLocation
BaiduNetworkLocation
@ -78,24 +79,6 @@ ui_print () {
echo -n -e "ui_print\n" >> /proc/self/fd/${OUTFD}
}
detect_outfd () {
readlink /proc/$$/fd/${OUTFD} 2>/dev/null | grep /tmp >/dev/null
if [ "$?" -eq "0" ]; then
OUTFD=0
for FD in $(ls /proc/$$/fd); do
readlink /proc/$$/fd/${FD} 2>/dev/null | grep pipe >/dev/null
if [ "$?" -eq "0" ]; then
ps | grep " 3 ${FD} " | grep -v grep >/dev/null
if [ "$?" -eq "0" ]; then
OUTFD=${FD}
break
fi
fi
done
fi
}
solve_gappsconflicts () {
for app in ${GOOGLE_APPS}; do
${NANODROID_BINDIR}/nanodroid-overlay --add ${app}
@ -109,6 +92,20 @@ solve_gappsconflicts () {
done
}
detect_outfd () {
if [ -z $OUTFD ] || readlink /proc/$$/fd/$OUTFD | grep -q /tmp; then
# We will have to manually find out OUTFD
for FD in `ls /proc/$$/fd`; do
if readlink /proc/$$/fd/$FD | grep -q pipe; then
if ps | grep -v grep | grep -q " 3 $FD "; then
OUTFD=$FD
break
fi
fi
done
fi
}
detect_outfd
case "${1}" in

@ -143,16 +143,12 @@ installinfo_add () {
}
detect_outfd () {
readlink /proc/$$/fd/${OUTFD} 2>/dev/null | grep /tmp >/dev/null
if [ "$?" -eq "0" ]; then
OUTFD=0
for FD in $(ls /proc/$$/fd); do
readlink /proc/$$/fd/${FD} 2>/dev/null | grep pipe >/dev/null
if [ "$?" -eq "0" ]; then
ps | grep " 3 ${FD} " | grep -v grep >/dev/null
if [ "$?" -eq "0" ]; then
OUTFD=${FD}
if [ -z $OUTFD ] || readlink /proc/$$/fd/$OUTFD | grep -q /tmp; then
# We will have to manually find out OUTFD
for FD in `ls /proc/$$/fd`; do
if readlink /proc/$$/fd/$FD | grep -q pipe; then
if ps | grep -v grep | grep -q " 3 $FD "; then
OUTFD=$FD
break
fi
fi

Loading…
Cancel
Save