#!/bin/sh #taken from http://fanoush.wz.cz/maemo/initfs_flasher.tgz # use gainroot to become root and relaunch itself if [ `id -u` != 0 ] ; then #if not already root, call itself as root TTY=`tty` [ "$TTY" = "not a tty" ] && unset TTY exec sudo gainroot <<EOF # sudo $0 $* if [ -z "$TTY" ] ; then exec $0 $* ; else exec <$TTY $0 $* ; fi EOF exit $? fi # real script follows