#!/usr/bin/python2

import os
import commands
import gettext

gettext.install("pearlinstall", "/usr/share/pearllinux/locale")

launcher = commands.getoutput("/usr/lib/pearllinux/common/pearl-which-launcher.py \"%s\"" % _("Please enter your password to start the software manager"))

status = 9  # status code 9 is used to restart the app

if os.getuid() != 0:
    os.system("LC_NUMERIC='C' %s pearlinstall" % launcher)
    status = 0  # Don't call pearlinstall

while status == 9:
    status = int(os.system("LC_NUMERIC='C' /usr/lib/pearllinux/pearlinstall/pearlinstall.py") / 256)  # exit code is upper 8 bits
