#!/usr/bin/python

import os
import sys
import commands 
import gettext

gettext.install("mintinstall", "/usr/share/linuxmint/locale")

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

if len(sys.argv) > 1:
	mintfile = sys.argv[1]
	command = "%s /usr/lib/linuxmint/mintInstall/mintInstall.py %s %s %s" % (launcher, mintfile, os.getenv("USER"), os.getenv("HOME"))
	os.system(command)
else:
	status = 9 # status code 9 is used to restart the app
	while status == 9:
		status = int(os.system("/usr/lib/linuxmint/mintInstall/mintinstall.py") / 256) # exit code is upper 8 bits
		

