149 |
# this wrapper runs a command in the xsession of the unpriv_user |
# this wrapper runs a command in the xsession of the unpriv_user |
150 |
x11runas() |
x11runas() |
151 |
{ |
{ |
152 |
if [[ -n $(pidof X) ]] |
if [[ -n $(pidof X) ]] || [[ -n $(pidof Xorg) ]] |
153 |
then |
then |
154 |
su - "${MCORE_UNPRIV_USER}" -c "DISPLAY=${MCORE_XORG_DISPLAY} '$@'" |
su - "${MCORE_UNPRIV_USER}" -c "DISPLAY=${MCORE_XORG_DISPLAY} $@" |
155 |
fi |
fi |
156 |
} |
} |
157 |
|
|
253 |
|
|
254 |
chroot ${MROOT} ${cmd} |
chroot ${MROOT} ${cmd} |
255 |
} |
} |
256 |
|
|
257 |
|
# gets interface used to reach given ip |
258 |
|
iface_for_remote_addr() |
259 |
|
{ |
260 |
|
set -- $(ip -o route get to $1) |
261 |
|
echo $5 |
262 |
|
} |
263 |
|
|
264 |
|
# get ip from dns name |
265 |
|
dns_to_ip() |
266 |
|
{ |
267 |
|
set -- $(getent hosts $1) |
268 |
|
echo $1 |
269 |
|
} |