Commit 2ff721af authored by Tails developers's avatar Tails developers
Browse files

Get rid of bashisms and migrade to /bin/sh.

parent 92eadd02
#!/bin/bash #!/bin/sh
SQUASH=/live/image/live/filesystem.squashfs SQUASH=/live/image/live/filesystem.squashfs
ROFS=/live/rofs ROFS=/live/rofs
...@@ -15,22 +15,23 @@ cleanup () { ...@@ -15,22 +15,23 @@ cleanup () {
# Break down the chroot and kill all of its processes # Break down the chroot and kill all of its processes
local counter=0 local counter=0
local ret=0 local ret=0
while [ "${counter}" -le 10 ] && pgrep -u ${CLEARNET_USER} &>/dev/null; do while [ "${counter}" -le 10 ] && \
pkill -u ${CLEARNET_USER} &>/dev/null pgrep -u ${CLEARNET_USER} 1>/dev/null 2>&1; do
pkill -u ${CLEARNET_USER} 1>/dev/null 2>&1
ret=${?} ret=${?}
sleep 1 sleep 1
counter=$[${counter}+1] counter=$((${counter}+1))
done done
[ ${ret} -eq 0 ] || pkill -9 -u ${CLEARNET_USER} &>/dev/null [ ${ret} -eq 0 ] || pkill -9 -u ${CLEARNET_USER} 1>/dev/null 2>&1
for mnt in ${CHROOT}{/dev,/proc,} ${COW} ${ROFS}; do for mnt in ${CHROOT}/dev ${CHROOT}/proc ${CHROOT} ${COW} ${ROFS}; do
counter=0 counter=0
while [ "${counter}" -le 10 ] && mountpoint ${mnt} &>/dev/null; do while [ "${counter}" -le 10 ] && mountpoint -q ${mnt} 2>/dev/null; do
umount ${mnt} &>/dev/null umount ${mnt} 2>/dev/null
sleep 1 sleep 1
counter=$[${counter}+1] counter=$((${counter}+1))
done done
done done
rmdir ${ROFS} ${COW} ${CHROOT} &>/dev/null rmdir ${ROFS} ${COW} ${CHROOT} 2>/dev/null
} }
error () { error () {
...@@ -81,7 +82,7 @@ configure_chroot () { ...@@ -81,7 +82,7 @@ configure_chroot () {
chmod a+r ${CHROOT}/etc/resolv.conf chmod a+r ${CHROOT}/etc/resolv.conf
# Disable problematic Iceweasel addons and proxying in the chroot # Disable problematic Iceweasel addons and proxying in the chroot
chroot ${CHROOT} apt-get remove --yes ${OFFENDING_ADDONS} &>/dev/null chroot ${CHROOT} apt-get remove --yes ${OFFENDING_ADDONS} 1>/dev/null 2>&1
sed -i '/^pref("network.proxy.type",/d' \ sed -i '/^pref("network.proxy.type",/d' \
${CHROOT}/etc/iceweasel/pref/iceweasel.js ${CHROOT}/etc/iceweasel/pref/iceweasel.js
echo 'pref("network.proxy.type", 0);' >> \ echo 'pref("network.proxy.type", 0);' >> \
...@@ -90,9 +91,9 @@ configure_chroot () { ...@@ -90,9 +91,9 @@ configure_chroot () {
start_browser_in_chroot () { start_browser_in_chroot () {
# Start Iceweasel in the chroot # Start Iceweasel in the chroot
sudo -u ${SUDO_USER} xhost +SI:localuser:${CLEARNET_USER} &>/dev/null sudo -u ${SUDO_USER} xhost +SI:localuser:${CLEARNET_USER} 2>/dev/null
chroot ${CHROOT} sudo -u ${CLEARNET_USER} iceweasel -DISPLAY=:0.0 chroot ${CHROOT} sudo -u ${CLEARNET_USER} iceweasel -DISPLAY=:0.0
sudo -u ${SUDO_USER} xhost -SI:localuser:${CLEARNET_USER} &>/dev/null sudo -u ${SUDO_USER} xhost -SI:localuser:${CLEARNET_USER} 2>/dev/null
} }
tor_is_working() { tor_is_working() {
...@@ -108,9 +109,9 @@ maybe_restart_tor () { ...@@ -108,9 +109,9 @@ maybe_restart_tor () {
# Tor from bootstrapping, and a restart is the fastest way to get # Tor from bootstrapping, and a restart is the fastest way to get
# wheels turning) # wheels turning)
if ! tor_is_working; then if ! tor_is_working; then
service tor restart &>/dev/null service tor restart 2>/dev/null
until nc -z localhost 9051 &>/dev/null; do sleep 1; done until nc -z localhost 9051 2>/dev/null; do sleep 1; done
/etc/NetworkManager/dispatcher.d/60-vidalia.sh clearnet up &>/dev/null /etc/NetworkManager/dispatcher.d/60-vidalia.sh clearnet up 2>/dev/null
fi fi
} }
...@@ -128,7 +129,7 @@ if [ -z "${IP4_NAMESERVERS}" ]; then ...@@ -128,7 +129,7 @@ if [ -z "${IP4_NAMESERVERS}" ]; then
fi fi
verify_start verify_start
trap cleanup SIGINT trap cleanup INT
setup_chroot setup_chroot
configure_chroot configure_chroot
start_browser_in_chroot start_browser_in_chroot
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment