Beispiel #1
0
    def Finish(self):
        ## Get all configure information ##
        if not (
                self.leLocation.text() == None and
                self.leUsername.text() == None and
                self.leFirstName.text() == None and
                self.leLastName.text() == None and
                self.leEmail.text() == None and
                self.lePhone.text() == None and
                self.chpath.currentText() == None and
                self.chds.currentText() == None
        ):
            location = self.leLocation.text()
            username = self.leUsername.text()
            firstname = self.leFirstName.text()
            lastname = self.leLastName.text()
            email = self.leEmail.text()
            phone = self.lePhone.text()

            if self.chds.isChecked():
                desktop_shortcut = True

            if self.chpath.isChecked():
                file = open ('/usr/bin/Rachel','w')
                file.write('cd '+location+' && {0} rachel.pyc'.replace('{0}',sys.executable))
                file.close()

                os.system('chmod +x /usr/bin/Rachel')

            ## Write Datas ##
            control.write_record('username',username,'packs/rachel/data/etc/rachel')
            control.write_record('firstname', firstname, 'packs/rachel/data/etc/rachel')
            control.write_record('lastname', lastname, 'packs/rachel/data/etc/rachel')
            control.write_record('email', email, 'packs/rachel/data/etc/rachel')
            control.write_record('phone', phone, 'packs/rachel/data/etc/rachel')

            ## create compile files ##
            ## pre build ##
            if os.path.isdir("stor"): shutil.rmtree("stor")

            if not os.path.isdir("app"):
                os.mkdir("app")
                os.mkdir("app/cache")
                os.mkdir("app/cache/archives")
                os.mkdir("app/cache/archives/data")
                os.mkdir("app/cache/archives/control")
                os.mkdir("app/cache/archives/code")
                os.mkdir("app/cache/archives/build")
                os.mkdir("app/cache/gets")

            if not os.path.isdir("stor"):
                os.mkdir("stor")
                os.mkdir("stor/app")
                os.mkdir("stor/app/packages")

            if not os.path.isdir("build-packs"): os.mkdir("build-packs")

            pack.install()
            shutil.copyfile('stor/usr/app/rachel.pyc', 'stor/rachel.pyc')

            shutil.make_archive('rachel', 'zip', 'stor')

            # clean #
            if os.path.isdir('app'): shutil.rmtree('app')
            if os.path.isdir('build-packs'): shutil.rmtree('build-packs')
            if os.path.isdir('stor'): shutil.rmtree('stor')


            # unpack archive #
            shutil.unpack_archive('rachel.zip',self.leLocation.text(),'zip')

            if os.path.isfile('rachel.zip'): os.remove('rachel.zip')
Beispiel #2
0
## pre build ##

if not os.path.isdir("app"):
    os.mkdir("app")
    os.mkdir("app/cache")
    os.mkdir("app/cache/archives")
    os.mkdir("app/cache/archives/data")
    os.mkdir("app/cache/archives/control")
    os.mkdir("app/cache/archives/code")
    os.mkdir("app/cache/archives/build")
    os.mkdir("app/cache/gets")

if not os.path.isdir("stor"):
    os.mkdir("stor")
    os.mkdir("stor/app")
    os.mkdir("stor/app/packages")

if not os.path.isdir("build-packs"): os.mkdir("build-packs")

# build #

pack.install()
pack.inst('baran')

# run #
if os.path.isfile('stor/proc/0'): os.remove('stor/proc/0')
if os.path.isfile('stor/proc/id/desktop'): os.remove('stor/proc/id/desktop')
if not os.path.isdir('stor/proc/id'): os.mkdir('stor/proc/id')

shutil.make_archive('stor', 'zip', 'stor')
import clean
Beispiel #3
0
    def Finish(self):
        ## Get all configure information ##
        if not (self.leHostname.text() == None and self.leRootCode.text()
                == None and self.leConfirmRootCode.text() == None
                and self.leUsername.text() == None and self.lePassword.text()
                == None and self.leConfirmPassword.text() == None
                and self.leFirstName.text() == None
                and self.leLastName.text() == None
                and self.leEmail.text() == None and self.lePhone.text() == None
                and self.cmUI.currentText() == None
                and self.cmLang.currentText() == None
                and self.cmScreen.currentText() == None):
            hostname = self.leHostname.text()
            rootcode = self.leRootCode.text()
            username = self.leUsername.text()
            password = self.lePassword.text()
            first_name = self.leFirstName.text()
            last_name = self.leLastName.text()
            email = self.leEmail.text()
            phone = self.lePhone.text()
            if self.chGuest.isChecked():
                guest = 'Yes'
            else:
                guest = 'No'

            interface = self.cmUI.currentText()
            if self.cmLang.currentText() == 'English':
                locale = 'en'
            elif self.cmLang.currentText() == 'فارسی':
                locale = 'fa'
            elif self.cmLang.currentText() == 'عربی':
                locale = 'ar'
            else:
                locale = 'en'

            ## Compile Pyabr ##
            if os.path.isdir("stor"): shutil.rmtree("stor")

            if not os.path.isdir("app"):
                os.mkdir("app")
                os.mkdir("app/cache")
                os.mkdir("app/cache/archives")
                os.mkdir("app/cache/archives/data")
                os.mkdir("app/cache/archives/control")
                os.mkdir("app/cache/archives/code")
                os.mkdir("app/cache/archives/build")
                os.mkdir("app/cache/gets")

            if not os.path.isdir("stor"):
                os.mkdir("stor")
                os.mkdir("stor/app")
                os.mkdir("stor/app/packages")

            if not os.path.isdir("build-packs"): os.mkdir("build-packs")

            pack.install()
            pack.inst('baran')

            # clean #
            if os.path.isdir('app'): shutil.rmtree('app')
            if os.path.isdir('build-packs'): shutil.rmtree('build-packs')

            ## Setting up hostname ##
            file = open("stor/etc/hostname", "w")
            file.write(hostname)
            file.close()

            ## Setting up Root user ##
            file = open("stor/etc/users/root", "w")
            file.write("username: "******"root".encode()).hexdigest() + "\n")
            file.write("code: " +
                       hashlib.sha3_512(rootcode.encode()).hexdigest() + "\n")
            file.write('first_name: Super Account')
            file.close()

            ## Setting up Standard user ##
            file = open("stor/etc/users/" + username, "w")
            file.write("username: "******"\n")
            file.write("code: " +
                       hashlib.sha3_512(password.encode()).hexdigest() + "\n")
            file.write("first_name: " + first_name + "\n")
            file.write("last_name: " + last_name + "\n")
            file.write("email: " + email + "\n")
            file.write("phone: " + phone + "\n")
            file.close()

            # permit #
            control.write_record(f'/desk/{username}', f'drwxr-x---/{username}',
                                 'stor/etc/permtab')

            # sudoers #
            f = open('stor/etc/sudoers', 'w')
            f.write(f'{username}\n')
            f.close()

            ## Setting up Guest user ##
            file = open("stor/etc/guest", "w")
            if guest == "No":
                file.write("enable_cli: No\nenable_gui: No\n")
            elif guest == "Yes":
                file.write("enable_cli: Yes\nenable_gui: Yes\n")
            else:
                file.write("enable_cli: No\nenable_gui: No\n")
            file.close()

            ## Setting up interface ##
            file = open("stor/etc/interface", "w")
            if interface.startswith("C"):
                file.write("CLI")
            elif interface.startswith("G"):
                file.write("GUI")
            file.close()

            ## Setting GUI Table ##
            file = open("stor/etc/gui", "w")
            file.write(f'''
#!etcetra

desktop: baran
fullscreen: Yes
sides: No
width: 1280
height: 720
autosize: Yes
logo: @icon/pyabr-logo
locale: {locale}
backend.color: black
backend.timeout: 1000
taskbar.location: bottom
taskbar.pins: roller,barge,calculator,calendar,commento,pysys,runapp
splash.timeout: 3000
splash.logo: @icon/pyabr-logo
splash.logo-size: 300
splash.color: #ABCDEF
login.bgcolor: #123456
login.background: @background/default
login.fgcolor: #FFFFFF
enter.bgcolor: #fff
enter.background: @background/default
enter.fgcolor: #FFFFFF
unlock.bgcolor: #123456
unlock.background: @background/default
unlock.fgcolor: #FFFFFF
loginw.bgcolor: white
loginw.fgcolor: black
loginw.round: Yes
loginw.round-size: 20 20
loginw.location: center
loginw.shadow: Yes
loginw.userlogo: @icon/account
loginw.userlogo.shadow: Yes
loginw.userlogo.color: white
loginw.userlogo.round: Yes
loginw.userlogo.round-size: 125 125
loginw.input.shadow: Yes
loginw.input.fgcolor: gray
loginw.input.bgcolor: white
loginw.input.round: Yes
loginw.input.round-size: 20 20
loginw.input.font-size: 12
taskbar.bgcolor: white
taskbar.fgcolor: black
taskbar.locked: Yes
taskbar.float: Yes
taskbar.size: 70
desktop.bgcolor: white
desktop.fgcolor: black
desktop.background: @background/default
lock.fgcolor: black
lock.bgcolor: black
lock.background: @background/default
lock.clock.shadow: Yes
lock.clock.size: 100
lock.clock.color: white
lock.clock.location: center
loginw.login.round: Yes
loginw.login.round-size: 20
loginw.enter.round: Yes
loginw.enter.round-size: 20
loginw.unlock.round: Yes
loginw.unlock.round-size: 20
submenu.hide: No
submenu.fgcolor: black
submenu.bgcolor: white
submenu.direction: ltr
submenu.fontsize: 12
loginw.login.bgcolor: #ABCDEF
loginw.login.fgcolor: #FFFFFF
loginw.login.bgcolor-hover: #123456
loginw.login.fgcolor: #FFFFFF
loginw.login.fontsize: 12
loginw.login.hide: No
loginw.login.width: 300
loginw.enter.bgcolor: pink
loginw.enter.fgcolor: #FFFFFF
loginw.enter.bgcolor-hover: purple
loginw.enter.fgcolor: #FFFFFF
loginw.enter.fontsize: 12
loginw.enter.hide: No
loginw.enter.width: 300
loginw.unlock.bgcolor: green
loginw.unlock.fgcolor: #FFFFFF
loginw.unlock.bgcolor-hover: lime
loginw.unlock.fgcolor: #FFFFFF
loginw.unlock.fontsize: 12
loginw.unlock.hide: No
loginw.unlock.width: 300
loginw.enter.shadow: No
loginw.unlock.shadow: No
loginw.login.shadow: No
loginw.login.height: 40
loginw.enter.height: 40
loginw.unlock.height: 40
appw.body.fgcolor: black
appw.body.bgcolor: white
appw.logo: @icon/app
appw.shadow: Yes
appw.title.size: 50
appw.title.fgcolor: white
appw.title.bgcolor: #123456
appw.title.float: @icon/float
appw.title.float-hover: #ABCDEF
appw.title.close: @icon/close
appw.title.close-hover: red
            ''')
            file.close()

            ## Copying to location ##
            shutil.make_archive("stor", "zip", "stor")
            os.system('chmod 777 -R /stor')
            shutil.unpack_archive("stor.zip", '/stor', "zip")
            ## run pyabr ##
            os.system('mkdir -p /stor/proc/info')
            if os.path.isfile('/stor/proc/0'):
                os.system('rm /stor/proc/0')
            os.system('systemctl reboot')