aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos.K <freedomrfox@gmail.com>2017-10-09 17:54:44 +0000
committerChristos.K <freedomrfox@gmail.com>2017-10-09 17:54:44 +0000
commit52c08af56d7a83999a7bd14b2518aec3f19d6cbd (patch)
tree5854ed33946a9ac3a1c4ec04f2d9288a6cb93d6f
parentMinor flow changes (diff)
downloadGSE-52c08af56d7a83999a7bd14b2518aec3f19d6cbd.tar.gz
GSE-52c08af56d7a83999a7bd14b2518aec3f19d6cbd.tar.bz2
GSE-52c08af56d7a83999a7bd14b2518aec3f19d6cbd.zip
Relocated
-rwxr-xr-xscripts/pyfunctions/arg_opt.py311
-rw-r--r--scripts/pyfunctions/gmen_opt.py147
-rw-r--r--scripts/pyfunctions/gportal.py77
-rw-r--r--scripts/pyfunctions/gseout.py36
-rw-r--r--scripts/pyfunctions/gsub_men.py493
-rwxr-xr-xscripts/pyfunctions/preliminary.py173
6 files changed, 0 insertions, 1237 deletions
diff --git a/scripts/pyfunctions/arg_opt.py b/scripts/pyfunctions/arg_opt.py
deleted file mode 100755
index 35a74ce..0000000
--- a/scripts/pyfunctions/arg_opt.py
+++ /dev/null
@@ -1,311 +0,0 @@
-#!/usr/bin/env python3.6
-
-gse_des = '''\
- -----------------------------------------------------------------
-
- GSE: This project was built under GSoC 2017 for Gentoo Fundation.
- For more informations see man gse.5 or the project's wiki at:
- https://wiki.gentoo.org/wiki/User:Ulfox/GSoC-GSE
-
- -----------------------------------------------------------------
-
- System: For system menu, run: gse system -h
- Controller: For controller menu, run: gse controller -h
- '''
-gse_usage="%(prog)s system --base=[precomp/catalyst] [options] / controller [options] / [-h/--help]"
-
-gse_ver = '%(prog)s Experimental'
-
-# System arguments
-def _export_args(sequence):
- # Library for arguments and options parse
- import argparse
-
- # Definition of name, usage and description for the options menu
- parser = argparse.ArgumentParser(prog="gse",
- formatter_class=argparse.RawDescriptionHelpFormatter,
- description=gse_des,
- usage=gse_usage,
- epilog="For more information about each option, please see man gse.1 " +
- "This program is distributed under GPL-2 license",
- add_help=True)
-
- # Dev opt
- parser.add_argument('--dev',
- help="Marked for removal. Removes all kind of checks. Never run this with super user privileges. It exists only for the experimental developing phase.",
- action="store_true",
- default=False)
-
- parser.add_argument("target",
- help="Initiate either system or controller scripts. [system/controller] ",
- action="store",
- default=None)
-
- parser.add_argument("--gmm",
- help="GUI Menu",
- action="store_true",
- default=False)
-
- parser.add_argument("--mm",
- help="Text Menu",
- action="store_true",
- default=False)
-
- if sequence == 'system':
- # Base definition. While base appears to be optional, it is not, since it's always required to initiate the building sequence
- parser.add_argument('-b', '--base',
- help='''Set the system's fundation. See man gse.1 for more.''',
- action="store",
- type=str,
- default='catalyst')
-
- # Force new optional argument
- parser.add_argument('-fcn', '--forcenew', '--force-new',
- help='''Enable force to all project's actions. This option purges all previous work done. Not recommended!''',
- action="store_true",
- default=False)
-
- # Fetch new optional argument
- parser.add_argument('-fn', '--fetchnew', '--fetch-new',
- help="Enable fetch option. Will always download requested files, even if they exist and are up to date.",
- action="store_true",
- default=False)
-
- # Keep optional argument.
- parser.add_argument('-k', '--keep',
- help='''Enable gse keep old work instead of purging / reconfiguring. This option does not work with force''',
- action="store_true",
- default=False)
-
- # Health check argument
- parser.add_argument('-hc', '--healthcheck', '--health-check',
- help='''Run integrity check for the project's scripts and essential configuration files''',
- action="store_true",
- default=False)
-
- # Replace new argument
- parser.add_argument('-rpn', '--replacenew', '--replace-new',
- help='''Refresh all the project's scripts and configuration files.
- Warning: All user configuration files will be lost''',
- action="store_true")
-
- # Disable kernel build optional argument
- parser.add_argument('-ke', '--kernel',
- help='''Disable kernel build action inside the chroot phase''',
- action="store_true",
- default=False)
-
- # Disable initramfs build optional argument
- parser.add_argument('-i', '--initrd',
- help='''Disable initramfs build action inside the chroot phase''',
- action="store_true",
- default=False)
-
- # Enable automatic mode.
- parser.add_argument('--auto',
- help="Enable automatic mode. All prompt actions will turn to yes/continue.",
- action="store_true",
- default=False)
-
- # Minimal build
- parser.add_argument('-bm', '--minimal', '--build-minimal',
- help="""Enable minimal build. This option removes and disables many features. The system image configured for size.""",
- action="store_true",
- default=False)
-
- # Enforce arguments
- parser.add_argument('--enforce',
- help="Enforce (force) a specific Part of the process. More about stages and parts at man gse.5",
- action="store",
- nargs='+',
- default=None,
- type=str)
-
- # Lawful-good arguments
- parser.add_argument('--lawfulgood', '--lawful-good',
- help="Lawful good (pass) a specific Part of the process. More about stages and parts at man gse.5",
- action="store",
- nargs='+',
- default=None,
- type=str)
-
- # Time-warp option
- parser.add_argument('--timewarp', '--time-warp',
- help="Load and execut a saved state. A state is the set of configuration files and arguments that were saved at a given time.",
- action="store",
- type=int)
-
- # Time-state option
- parser.add_argument('--timestate', '--time-state',
- help="Create a state. The state can be initiated by time-warp function.",
- action="store",
- default='no',
- type=str)
-
- # Distcc
- parser.add_argument('--distcc',
- help="Enable distcc mode for the system build process. For pump, give --distcc=pump. See man 5 gse for more informations.",
- action="store",
- default=None,
- type=str)
-
- # Ccache
- parser.add_argument('--ccache',
- help="Enable ccache for the system build process.",
- action="store_true",
- default=False)
-
- # No check option
- parser.add_argument('--nochecks', '--no-checks',
- help="Disable all checks. The process will be enabled without requesting a return 0 from the system check function.",
- action="store_true",
- default=False)
-
- # Edit configs option
- parser.add_argument('-e', '--edit',
- help='''Edit X:Y config. Where X is the category and Y is the file. See man gse.1 for more informations''',
- action="store",
- type=str)
-
- # Verbose option
- parser.add_argument('-v', '--verbose',
- help="Enable verbose output for all actions.",
- action='count')
-
- # Quiet option
- parser.add_argument('-q', '--quiet',
- help="Enable quiet global flag. This flag suppresses all output with a simple text entry regarding the action.",
- action="store_true",
- default=False)
-
- # Version
- parser.add_argument('-V', '--version',
- help="Show project's version and exit.",
- action='version',
- version=gse_ver)
-
- elif sequence == 'controller':
- # Build the controller option
- parser.add_argument('-bc', '--controller', '--build-controller',
- help='''Request the initramfs-controller image. Not to confuse with the --initrd. See man gse.1 for more informations.''',
- action="store_true",
- default=False)
-
- # Force option
- parser.add_argument('--force',
- help="Enable Dracut's force flag. The option is for simplicity over --dracut_opt=-f",
- action="store_true",
- default=False)
-
- # Hook script option
- parser.add_argument('--hook',
- help="Add custom scripts to Dracut hook points. Use this for simple scripts instead of creating new modules.",
- action="store",
- default=None,
- type=str)
-
- # Net script option
- parser.add_argument('--net',
- help="Import a custom net script to be sourced before initiating the controller scripts. That is after udev has finished.",
- action="store",
- default=None,
- type=str)
-
- # Module config
- parser.add_argument('--modules',
- help="Import a custom module config file under /etc/modprobe.d with name umod.conf.",
- action="store",
- default=None,
- type=str)
-
- # Dracut's option cmdline
- parser.add_argument('--dracut_opt',
- help="Include extra options for dracut. For more info see man dracut",
- action="store",
- default=None,
- type=str)
-
- # Version
- parser.add_argument('-V', '--version',
- help="Show project's version and exit.",
- action='version',
- version=gse_ver)
-
- args = parser.parse_args()
-
- del parser
- del argparse
-
- return args
-
-
-# Check system's arguments
-def _check_args(args):
- # Libraries for
- from sys import argv
- from gseout import die, e_report
-
- if args.quiet and not args.verbose == None:
- die("Error: Quiet and Verbose can not be used at the same time")
-
- if args.forcenew and args.keep:
- die("Error: Force new can not be used with keep")
-
- if args.edit and not len(argv[2:]) == 1:
- die("Invalid options for --edit. Please give only the related XY number.")
-
- if args.forcenew and not args.lawfulgood == None:
- die("Warning: --force-new suppresses --lawful-good")
-
- if not args.lawfulgood == None and not args.enforce == None:
- e_report("Warning: --lawful-good suppresses --enforce")
-
- if args.healthcheck and not len(argv[1:]) == 1:
- die("Warning: --health-check unknown parameters")
-
- if args.replacenew and not len(argv[1:]) == 1:
- die("Warning: --replace-new unknown parameters")
-
- if args.base == 'catalyst' or args.base == 'precomp':
- e_report("System base saved for " + args.base)
- else:
- die("Wrong base entry. Please give either 'catalyst' or 'precomp'")
-
- # Export enforce hook point entries
- if not args.enforce == None:
- en_args = args.enforce[0]
- args.enforce = []
- args.enforce = [x.strip() for x in en_args.split(':')]
- del en_args
-
- # Export lawful-good hook point entries
- if not args.lawfulgood == None:
- lg_args = args.lawfulgood[0]
- args.lawfulgood = []
- args.lawfulgood = [x.strip() for x in lg_args.split(':')]
- del lg_args
-
- # Issue warning if minimal and enforce with ginst or gkernel or gintrid are enabled simultaneously
- if args.minimal:
- _minimal_exclude = [ "ginst", "gkernel", "gintrid"]
-
- for i in _minimal_exclude[:]:
- if i in args.enforce[:] and args.minimal:
- e_report("Warning: --build-minimal suppresses " + i)
-
- del _minimal_exclude
-
-
-
- del die, argv, e_report
-
-
-# Check controller's arguments
-def _ct_check_args(args):
- pass
-
-
-
-
-
-
diff --git a/scripts/pyfunctions/gmen_opt.py b/scripts/pyfunctions/gmen_opt.py
deleted file mode 100644
index 29b6207..0000000
--- a/scripts/pyfunctions/gmen_opt.py
+++ /dev/null
@@ -1,147 +0,0 @@
-#!/usr/bin/env python3.6
-
-def _men_opt(_men_call):
- from gseout import report_colors
- from sys import exit
-
- if _men_call is '1':
- print("##################### " + report_colors.CYAN + "~~Main Menu~~" + report_colors.RESET + " ######################")
- print("## ##")
- print("## [ " + report_colors.GREEN + "I " + report_colors.RESET + "]" + report_colors.YELLOW + " System Menu " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "II " + report_colors.RESET + "]" + report_colors.YELLOW + " Build the controller image " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "III " + report_colors.RESET + "]" + report_colors.YELLOW + " GSE Tools " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "IV " + report_colors.RESET + "]" + report_colors.YELLOW + " Documentations " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "V " + report_colors.RESET + "]" + report_colors.YELLOW + " About the project " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "VI " + report_colors.RESET + "]" + report_colors.YELLOW + " I shouldn't be here, please let me leave! " + report_colors.RESET + "##")
- print("## ##")
- print("## [ " + report_colors.GREEN + "T " + report_colors.RESET + "]" + report_colors.YELLOW + " Terminal " + report_colors.RESET + "##")
- print("#############################################################")
-
- elif _men_call is "2":
- print("################### " + report_colors.CYAN + "~~Documentations~~" + report_colors.RESET + " ####################")
- print("## ##")
- print("## [ " + report_colors.GREEN + "I " + report_colors.RESET + "]" + report_colors.YELLOW + " Introduction to GSE Directory " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "II " + report_colors.RESET + "]" + report_colors.YELLOW + " The Controller " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "III " + report_colors.RESET + "]" + report_colors.YELLOW + " The Config.d Directory " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "IV " + report_colors.RESET + "]" + report_colors.YELLOW + " The script's Directory " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "V " + report_colors.RESET + "]" + report_colors.YELLOW + " Main Menu " + report_colors.RESET + "##")
- print("## ##")
- print("##############################################################")
-
- elif _men_call is "3":
- print("####################### " + report_colors.CYAN + "~~About~~" + report_colors.RESET + " ########################")
- print("## ##")
- print("## [ " + report_colors.GREEN + "I " + report_colors.RESET + "]" + report_colors.YELLOW + " About the project " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "II " + report_colors.RESET + "]" + report_colors.YELLOW + " Linux, Gentoo and the birth of an Idea " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "III " + report_colors.RESET + "]" + report_colors.YELLOW + " Open Source To The End and Beyond " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "IV " + report_colors.RESET + "]" + report_colors.YELLOW + " Main Menu " + report_colors.RESET + "##")
- print("## ##")
- print("#############################################################")
-
- elif _men_call is "5":
- print("###################### " + report_colors.CYAN + "~~Builder~~" + report_colors.RESET + " #####################")
- print("## ##")
- print("## [ " + report_colors.GREEN + "I " + report_colors.RESET + "]" + report_colors.YELLOW + " Built a System " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "II " + report_colors.RESET + "]" + report_colors.YELLOW + " Configure built variables " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "III" + report_colors.RESET + "]" + report_colors.YELLOW + " Select default system for distribution " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "IV " + report_colors.RESET + "]" + report_colors.YELLOW + " Create a stage4 tarball " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "V " + report_colors.RESET + "]" + report_colors.YELLOW + " Return back " + report_colors.RESET + "##")
- print("## ##")
- print("## [ " + report_colors.GREEN + "T " + report_colors.RESET + "]" + report_colors.YELLOW + " Terminal " + report_colors.RESET + "##")
- print("## ##")
- print("###########################################################")
-
- elif _men_call is "6":
- print("################# " + report_colors.CYAN + "~~System Menu~~" + report_colors.RESET + " ################")
- print("## ##")
- print("## [ " + report_colors.GREEN + "I " + report_colors.RESET + "]" + report_colors.YELLOW + " Portage " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "II " + report_colors.RESET + "]" + report_colors.YELLOW + " Catalyst " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "III" + report_colors.RESET + "]" + report_colors.YELLOW + " Precompiled " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "IV " + report_colors.RESET + "]" + report_colors.YELLOW + " Return back " + report_colors.RESET + "##")
- print("## ##")
- print("## [ " + report_colors.GREEN + "T " + report_colors.RESET + "]" + report_colors.YELLOW + " Terminal " + report_colors.RESET + "##")
- print("## ##")
- print("#####################################################")
-
- elif _men_call is "7":
- print("###################### " + report_colors.CYAN + "~~Portage~~ " + report_colors.RESET + " #####################")
- print("## ##")
- print("## [ " + report_colors.GREEN + "I " + report_colors.RESET + "]" + report_colors.YELLOW + " Guided/Automatic make.conf " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "II " + report_colors.RESET + "]" + report_colors.YELLOW + " Manually edit make.conf (Reset) " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "III" + report_colors.RESET + "]" + report_colors.YELLOW + " Features & ccashe " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "IV " + report_colors.RESET + "]" + report_colors.YELLOW + " Edit distcc " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "V " + report_colors.RESET + "]" + report_colors.YELLOW + " Edit packages.use " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "VI " + report_colors.RESET + "]" + report_colors.YELLOW + " Return back " + report_colors.RESET + "##")
- print("## ##")
- print("## [ " + report_colors.GREEN + "T " + report_colors.RESET + "]" + report_colors.YELLOW + " Terminal " + report_colors.RESET + "##")
- print("## ##")
- print("###########################################################")
-
- elif _men_call is "8":
- print("################## " + report_colors.CYAN + "~~Configurations~~" + report_colors.RESET + " ##################")
- print("## ##")
- print("## [ " + report_colors.GREEN + "I " + report_colors.RESET + "]" + report_colors.YELLOW + " Configure fstab/drives " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "II " + report_colors.RESET + "]" + report_colors.YELLOW + " Manually edit fstab " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "III " + report_colors.RESET + "]" + report_colors.YELLOW + " Manually edit drive names " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "IV " + report_colors.RESET + "]" + report_colors.YELLOW + " Edit Hostname " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "V " + report_colors.RESET + "]" + report_colors.YELLOW + " Edit /etc/conf.d/net " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "VI " + report_colors.RESET + "]" + report_colors.YELLOW + " Edit Locales " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "VII " + report_colors.RESET + "]" + report_colors.YELLOW + " Edit Consolefont " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "VIII " + report_colors.RESET + "]" + report_colors.YELLOW + " Edit sshd " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "IX " + report_colors.RESET + "]" + report_colors.YELLOW + " Edit sshkey " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "X " + report_colors.RESET + "]" + report_colors.YELLOW + " Symlink, bind, overlay and tmpfs " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "XI " + report_colors.RESET + "]" + report_colors.YELLOW + " Add Scripts " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "XII " + report_colors.RESET + "]" + report_colors.YELLOW + " Install Packages " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "XIII " + report_colors.RESET + "]" + report_colors.YELLOW + " Edit Default Grub " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "XIV " + report_colors.RESET + "]" + report_colors.YELLOW + " Edit runlevels*** " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "XV " + report_colors.RESET + "]" + report_colors.YELLOW + " Inject files " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "XVI " + report_colors.RESET + "]" + report_colors.YELLOW + " Return back " + report_colors.RESET + "##")
- print("## ##")
- print("## [ " + report_colors.GREEN + " T " + report_colors.RESET + "]" + report_colors.YELLOW + " Terminal " + report_colors.RESET + "##")
- print("## ##")
- print("###########################################################")
-
- elif _men_call is "9":
- print("################## " + report_colors.CYAN + "~~Select Default~~" + report_colors.RESET + " ##################")
- print("## ##")
- print("## [ " + report_colors.GREEN + "I " + report_colors.RESET + "]" + report_colors.YELLOW + " List systems " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "II " + report_colors.RESET + "]" + report_colors.YELLOW + " Edit default " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "III" + report_colors.RESET + "]" + report_colors.YELLOW + " Return back " + report_colors.RESET + "##")
- print("## ##")
- print("## [ " + report_colors.GREEN + "T " + report_colors.RESET + "]" + report_colors.YELLOW + " Terminal " + report_colors.RESET + "##")
- print("## ##")
- print("###########################################################")
-
- elif _men_call is "10":
- print("################### " + report_colors.CYAN + "~~Catalyst~~" + report_colors.RESET + " #################")
- print("## ##")
- print("## [ " + report_colors.GREEN + "I " + report_colors.RESET + "]" + report_colors.YELLOW + " Configure catalyst.conf " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "II " + report_colors.RESET + "]" + report_colors.YELLOW + " Configure catalystrc " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "III" + report_colors.RESET + "]" + report_colors.YELLOW + " Configure stage1 " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "IV " + report_colors.RESET + "]" + report_colors.YELLOW + " Configure stage2 " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "V " + report_colors.RESET + "]" + report_colors.YELLOW + " Configure stage3 " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "VI " + report_colors.RESET + "]" + report_colors.YELLOW + " \e[35mInitiate Build " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "VII" + report_colors.RESET + "]" + report_colors.YELLOW + " Return " + report_colors.RESET + "##")
- print("## ##")
- print("## [ " + report_colors.GREEN + "T " + report_colors.RESET + "]" + report_colors.YELLOW + " Terminal " + report_colors.RESET + "##")
- print("## ##")
- print("#####################################################")
-
- elif _men_call is "11":
- print("#################### " + report_colors.CYAN + "~~GSE Tools~~" + report_colors.RESET + " #####################")
- print("## ##")
- print("## [ " + report_colors.GREEN + "I " + report_colors.RESET + "]" + report_colors.YELLOW + " Renew ALL " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "II " + report_colors.RESET + "]" + report_colors.YELLOW + " Renew Scripts " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "III" + report_colors.RESET + "]" + report_colors.YELLOW + " Version Check " + report_colors.RESET + "##")
- print("## [ " + report_colors.GREEN + "IV " + report_colors.RESET + "]" + report_colors.YELLOW + " Return back " + report_colors.RESET + "##")
- print("## ##")
- print("## [ " + report_colors.GREEN + "T " + report_colors.RESET + "]" + report_colors.YELLOW + " Terminal " + report_colors.RESET + "##")
- print("## ##")
- print("###########################################################")
-
-
- del _men_call, report_colors
-
-
-
-
diff --git a/scripts/pyfunctions/gportal.py b/scripts/pyfunctions/gportal.py
deleted file mode 100644
index 9c5023b..0000000
--- a/scripts/pyfunctions/gportal.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env python3.6
-
-def _gmm():
- import tkinter
-
- def donothing():
- filewin = tkinter.Toplevel(portal)
- button = tkinter.Button(filewin, text="Do nothing button")
- button.pack()
-
- # Define portal as tkinter.Tk
- portal = tkinter.Tk()
-
- # Title
- portal.title("Portal Menu")
- # Window Geometry
- portal.geometry("1200x1024")
-
- # Define portal menu as portmen
- portmen = tkinter.Menu(portal)
-
- def _portfile():
- # Create file tab
- portfile = tkinter.Menu(portmen, tearoff=0)
- # Label the tab as File
- portmen.add_cascade(label="File", menu=portfile)
-
- # File's sub-menu
- portfile.add_command(label="New", command=donothing)
- portfile.add_command(label="Open", command=donothing)
- portfile.add_command(label="Save", command=donothing)
- portfile.add_command(label="Save as...", command=donothing)
- portfile.add_command(label="Close", command=donothing)
- portfile.add_separator()
- portfile.add_command(label="Exit", command=portal.quit)
-
- return portfile
-
-
- def _portedit():
-
- # Create edit tab
- portedit = tkinter.Menu(portmen, tearoff=0)
- # Label the tab as edit
- portmen.add_cascade(label="Edit", menu=portedit)
-
- portedit.add_command(label="Undo", command=donothing)
- portedit.add_separator()
-
- portedit.add_command(label="Cut", command=donothing)
- portedit.add_command(label="Copy", command=donothing)
- portedit.add_command(label="Paste", command=donothing)
- portedit.add_command(label="Delete", command=donothing)
- portedit.add_command(label="Select All", command=donothing)
-
- return portedit
-
-
- def _porthelp():
- porthelp = tkinter.Menu(portmen, tearoff=0)
- portmen.add_cascade(label="Help", menu=porthelp)
-
- porthelp.add_command(label="Help Index", command=donothing)
- porthelp.add_command(label="About...", command=donothing)
-
- return porthelp
-
- portfile = _portfile()
- portedit = _portedit()
- porthelp = _porthelp()
-
- portal.config(menu=portmen)
- portal.mainloop()
-
- return 0
-
-
diff --git a/scripts/pyfunctions/gseout.py b/scripts/pyfunctions/gseout.py
deleted file mode 100644
index 88729dc..0000000
--- a/scripts/pyfunctions/gseout.py
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env python3.6
-
-from sys import exit
-
-# Output colors
-class report_colors:
- SRED = "\033[0;31m"
- LRED = "\033[1;31m"
- BLUE = "\033[0;34m"
- YELLOW = "\033[0;33m"
- CYAN = "\033[1;36m"
- GREEN = "\033[0;32m"
- PURPLE = "\033[2;35m"
- RESET = "\033[0;0m"
-
-# Die function
-def die(error):
- print(report_colors.SRED + error + report_colors.RESET)
- exit(1)
-
-# Yellow report function
-def e_report(report):
- print(report_colors.YELLOW + report + report_colors.RESET)
-
-# Blue report function
-def b_report(report):
- print(report_colors.BLUE + report + report_colors.RESET)
-
-# Green report function
-def g_report(report):
- print(report_colors.GREEN + report + report_colors.RESET)
-
-# Purpule report function
-def p_report(report):
- print(report_colors.PURPLE + report + report_colors.RESET)
-
diff --git a/scripts/pyfunctions/gsub_men.py b/scripts/pyfunctions/gsub_men.py
deleted file mode 100644
index 038141c..0000000
--- a/scripts/pyfunctions/gsub_men.py
+++ /dev/null
@@ -1,493 +0,0 @@
-#!/usr/bin/env python3.6
-
-def _call_sub(*args):
- from gseout import report_colors, e_report, b_report
- from sys import exit
- from preliminary import portalin
-
- def main_f(*args):
- SELCT = portalin("_input")
-
- if SELCT in ['I', 'i', '1']:
- # Call builder submenu
- _sub_call = {"_CHILD": "BSM"}
-
- elif SELCT in ['II', 'ii', '2']:
- # Call controller submenu
- _sub_call = {"_CHILD": "CONTR"}
-
- elif SELCT in ['III', 'iii', '3']:
- # GSE renew submenu
- _sub_call = {"_CHILD": "GSET"}
-
- elif SELCT in ['IV', 'iv', '4']:
- # Call documentation submenu
- _sub_call = {"_CHILD": "DOC"}
-
- elif SELCT in ['V', 'v', '5']:
- # Call about submenu
- _sub_call = {"_CHILD": "AB"}
-
- elif SELCT in ['VI', 'vi', '6', 'q', 'Q']:
- e_report("Exiting...")
- _sub_call = {"_PARENT": 0}
-
- elif SELCT in ['t', 'T']:
- from preliminary import _shell
- _shell()
-
- _sub_call = {"_STAY": 0}
-
- del _shell
-
- del SELCT
-
- return _sub_call
-
-
- def gse_t(*args):
- SELCT = portalin("_input")
-
- if SELCT in ['I', 'i', '1']:
- pass
- exit(0)
-
- elif SELCT in ['II', 'ii', '2']:
- pass
- exit(0)
-
- elif SELCT in ['III', 'iii', '3']:
- # Version check
- # import version check function here
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['IV', 'iv', '4']:
- _sub_call = {"_PARENT": 0}
-
- elif SELCT in ['t', 'T']:
- from preliminary import _shell
- _shell()
-
- _sub_call = {"_STAY": 0}
-
- del _shell
-
- del SELCT
-
- return _sub_call
-
-
- def bs_menu_f(*args):
- SELCT = portalin("_input")
-
- if SELCT in ['I', 'i', '1']:
- # Call build system submenu
- _sub_call = {"_CHILD": "SM"}
-
- elif SELCT in ['II', 'ii', '2']:
- # Call configuration submenu
- _sub_call = {"_CHILD": "CO_F"}
-
- elif SELCT in ['III', 'iii', '3']:
- # CALL SELECT DEFAULT SYSTEM SUBMENU
- _sub_call = {"_CHILD": "SELDEF"}
-
- elif SELCT in ['IV', 'iv', '4']:
- # TBU: WILL INCLUDE A STAGE4 TARBALL CREATION
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['V', 'v', '5']:
- _sub_call = {"_PARENT": 0}
-
- elif SELCT in ['t', 'T']:
- from preliminary import _shell
- _shell()
-
- _sub_call = {"_STAY": 0}
-
- del _shell
-
- del SELCT
-
- return _sub_call
-
-
- def bs_f(*args):
- SELCT = portalin("_input")
-
- if SELCT in ['I', 'i', '1']:
- # CALL PORTAGE SUBMENU)
- _sub_call = {"_CHILD": "PORT_M"}
-
- elif SELCT in ['II', 'ii', '2']:
- # CALL CATALYST SUBMENU
- _sub_call = {"_CHILD": "CATA_M"}
-
- elif SELCT in ['III', 'iii', '3']:
- # START PRE PRECOMPILED
- # import warp "--base=precomp" "args" here
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['IV', 'iv', '4']:
- _sub_call = {"_PARENT": 0}
-
- elif SELCT in ['t', 'T']:
- from preliminary import _shell
- _shell()
-
- _sub_call = {"_STAY": 0}
-
- del _shell
-
- del SELCT
-
- return _sub_call
-
-
- def portage_men_f(CCONFDIR, *args):
- from subprocess import call
-
- SELCT = portalin("_input")
-
- if SELCT in ['I', 'i', '1']:
- # Make make.conf: Automatic or guided configuration
- _ex_stat = makeconf_ed
-
- if _ex_stat == 0:
- print(report_colors.YELLOW + "[ * ]" + report_colors.RESET + "Configuration was successful")
- else:
- print(report_colors.SRED + "[ * ]" + report_colors.RESET + "Something went wrong")
-
- del _ex_stat
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['II', 'ii', '2']:
- # Edit of make.conf
- call(["vim", CCONFDIR + "/system/portage/make.conf"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['III', 'iii', '3']:
- # Edit features
- call(["vim", CCONFDIR + "/system/coptions"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['IV', 'iv', '4']:
- # Edit distcc's hosts
- call(["vim", CCONFDIR + "/system/hosts"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['V', 'v', '5']:
- # Edit USEFLAGS
- call(["vim", CCONFDIR + "/system/portage/package.use/sysbuild"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['VI', 'vi', '6']:
- _sub_call = {"_PARENT": 0}
-
- elif SELCT in ['t', 'T']:
- from preliminary import _shell
- _shell()
-
- _sub_call = {"_STAY": 0}
-
- del _shell
-
- del SELCT, call
-
- return _sub_call
-
-
- def catalyst_f(CCONFDIR, args):
- from subprocess import call
-
- SELCT = portalin("_input")
-
- if SELCT in ['I', 'i', '1']:
- # Edit catalyst.conf
- call(["vim", CCONFDIR + "/system/catalyst/catalyst.conf"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['II', 'ii', '2']:
- # Edit catalystrc
- call(["vim", CCONFDIR + "/system/catalyst/catalystrc"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['III', 'iii', '3']:
- # Edit stage1.spec
- call(["vim", CCONFDIR + "/system/catalyst/stage1.spec"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['IV', 'iv', '4']:
- # Edit stage2.spec
- call(["vim", CCONFDIR + "/system/catalyst/stage2.spec"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['V', 'v', '5']:
- # Edit stage3.spec
- call(["vim", CCONFDIR + "/system/catalyst/stage3.spec"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['VI', 'vi', '6']:
- # Initiate system build
- #warp "--base=catalyst" "${lppar[@]}"
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['VII', 'vii', '7']:
- _sub_call = {"_PARENT": 0}
-
- elif SELCT in ['t', 'T']:
- from preliminary import _shell
- _shell()
-
- _sub_call = {"_STAY": 0}
-
- del _shell
-
- del SELCT, call
-
- return _sub_call
-
-
- def config_f(CCONFDIR, *args):
- from subprocess import call
-
- SELCT = portalin("_input")
-
- if SELCT in ['I', 'i', '1']:
- # Marked for removal
- #drv_interface
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['II', 'ii', '2']:
- # Edit fstab
- call(["vim", CCONFDIR + "/system/fstab"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['III', 'iii', '3']:
- # Edit devname.info
- call(["vim", CCONFDIR + "/system/devname.info"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['IV', 'iv', '4']:
- # Edit hostname
- call(["vim", CCONFDIR + "/system/hostname"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['V', 'v', '5']:
- # Edit conf.d/net
- call(["vim", CCONFDIR + "/system/net"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['VI', 'vi', '6']:
- # Edit locale
- call(["vim", CCONFDIR + "/system/locale.gen"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['VII', 'vii', '7']:
- # Edit consolefont
- call(["vim", CCONFDIR + "/system/consolefont"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['VIII', 'viii', '8']:
- # Edit sshd_config
- call(["vim", CCONFDIR + "/system/sshd"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['IX', 'ix', '9']:
- # Edit id_rsa.pub
- call(["vim", CCONFDIR + "/system/ssh.pub"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['X', 'x', "10"]:
- # Edit system links
- call(["vim", CCONFDIR + "/system/system_links"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['XI', 'xi', '11']:
- # Edit custom scripts
- call(["vim", CCONFDIR + "/system/custom_scripts"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['XII', 'xii', '12']:
- # Edit custom package list
- call(["vim", CCONFDIR + "/system/custom_pacl"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['XIII', 'xiii', '13']:
- # Edit /etc/default/grub
- call(["vim", CCONFDIR + "/system/grub"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['XIV', 'xiv', '14']:
- # Edit runlevels
- call(["vim", CCONFDIR + "/system/runlevels"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['XV', 'xv', '15']:
- # Edit files
- call(["vim", CCONFDIR + "/system/inject_files"], stdout=None, stderr=None)
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['XVI', 'xvi', '16']:
- _sub_call = {"_PARENT": 0}
-
- elif SELCT in ['t', 'T']:
- from preliminary import _shell
- _shell()
-
- _sub_call = {"_STAY": 0}
-
- del _shell
-
- del SELCT, call
-
- return _sub_call
-
-
- def selectdef_f(*args):
- SELCT = portalin("_input")
-
- if SELCT in ['I', 'i', '1']:
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['II', 'ii', '2']:
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['III', 'iii', '3']:
- _sub_call = {"_PARENT": 0}
-
- elif SELCT in ['t', 'T']:
- from preliminary import _shell
- _shell()
-
- _sub_call = {"_STAY": 0}
-
- del _shell
-
- del SELCT
-
- return _sub_call
-
-
- def doc_f(CWORKDIR, *args):
- from subprocess import call
-
- SELCT = portalin("_input")
-
- if SELCT in ['I', 'i', '1']:
- call(["man", CWORKDIR + "/docs/documentations/overview_gse.5"])
- portalin("_key")
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['II', 'ii', '2']:
- call(["man", CWORKDIR + "/docs/documentations/overview_controller.5"])
- portalin("_key")
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['III', 'iii', '3']:
- call(["man", CWORKDIR + "/docs/documentations/overview_config.d.5"])
- portalin("_key")
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['IV', 'iv', '4']:
- call(["man", CWORKDIR + "/docs/documentations/overview_scripts.5"])
- portalin("_key")
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['V', 'v', '5']:
- _sub_call = {"_PARENT": 0}
-
- elif SELCT in ['t', 'T']:
- from preliminary import _shell
- _shell()
-
- _sub_call = {"_STAY": 0}
-
- del _shell
-
- del SELCT, call
-
- return _sub_call
-
-
- def about_f(CWORKDIR, *args):
- SELCT = portalin("_input")
-
- if SELCT in ['I', 'i', '1']:
- e_report("About submenu option a)")
- portalin("_key")
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['II', 'ii', '2']:
- e_report("About submenu option b)")
- portalin("_key")
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['III', 'iii', '3']:
- e_report("About submenu option c)")
- portalin("_key")
-
- _sub_call = {"_STAY": 0}
-
- elif SELCT in ['IV', 'iv', '4']:
- _sub_call = {"_PARENT": 0}
-
- elif SELCT in ['t', 'T']:
- from preliminary import _shell
- _shell()
-
- _sub_call = {"_STAY": 0}
-
- del _shell
-
- del SELCT
-
- return _sub_call
-
-
- def controller_f(*args):
- e_report("Initiating controller build")
-
- _sub_call = {"_PARENT": 0}
-
- return _sub_call
-
- _sub_call = eval(args[0]+'(args[1])')
-
- del portalin, report_colors, e_report, b_report, exit
-
- return _sub_call
-
-
-
diff --git a/scripts/pyfunctions/preliminary.py b/scripts/pyfunctions/preliminary.py
deleted file mode 100755
index 103570b..0000000
--- a/scripts/pyfunctions/preliminary.py
+++ /dev/null
@@ -1,173 +0,0 @@
-#!/usr/bin/env python3.6
-
-# Gentoo check function
-def _is_gentoo():
- from subprocess import call
-
- _dist_check = call("grep ^NAME= /etc/*release | awk -F '=' '{print $2}' | grep -q Gentoo", stdout=None, stderr=None, shell=True)
-
- del call
-
- if _dist_check == 0:
- del _dist_check
- return 0
- else:
- return 1
-
-# Check for superuser privileges
-def _is_su():
- from subprocess import call
-
- _super_u = call("if [[ $(echo $UID) == 0 ]]; then exit 0; else exit 1; fi", stdout=None, stderr=None, shell=True)
-
- del call
-
- if _super_u == 0:
- del _super_u
- return 1
- else:
- return 1
-
-# Simple input call
-def portalin(_input):
- from gseout import report_colors
-
- if _input is "_input":
- portin = input(report_colors.YELLOW + "Input :: <= " + report_colors.RESET)
-
- elif _input is "_key":
- portin = input(report_colors.YELLOW + "Press any key to continue" + report_colors.RESET)
-
- del report_colors
- return portin
-
-
-# Simple shell call
-def _shell():
- from gseout import e_report
- from os import environ
-
- active_shell = environ['SHELL']
-
- e_report("Calling " + active_shell + ", please exit to resume script")
-
- import time
- time.sleep(3)
-
- from subprocess import call
-
- call([active_shell], stdout=None, stderr=None, shell=True)
- e_report("Proceeding")
-
- del e_report, time, call, active_shell, environ
-
-# Simple clear screen function
-def _clear():
- from os import system
- system("clear")
-
-# Parameter miss match error
-def _parameter_error():
- from gseout import die
- from os import system
- die("""
- [ FATAL ]
-
- If this message is printed while using the Maim Menu
- That means essential files are altered or something bad is happening.
-
- Please run a health-check from the ~Main Menu~ and a Version check first.
- If you see this again after the health/version check, please submit a bug report
- and stop using the program, or data loss may occur.
-
- Exiting...
- """)
-
-
-# Text main menu
-def _call_menu(CWORKDIR, CFUNCTIONS, CCONFDIR, CDISTDIR):
- from gsub_men import _call_sub
- from gmen_opt import _men_opt
-
- def _init_sub(men, bpar, spar, ccal, *args):
- print(*args)
-
- try:
- del _sub_call
-
- c = [_PARENT, _CHILD, _STAY]
-
- for i in c[:]:
- del i
-
- except NameError:
- pass
-
- while True:
- _clear()
-
- _men_opt(men)
-
- _sub_call = _call_sub(ccal, *args)
-
- for k, v in _sub_call.items():
- if k is "_PARENT" and v == 0:
- BACKTO = bpar
-
- elif k is "_CHILD":
-
- BACKTO = v
-
- elif k is "_STAY" and v == 0:
- BACKTO = spar
-
-
- return BACKTO
-
- def _main_loop(minit, CWORKDIR, CFUNCTIONS, CCONFDIR, CDISTDIR):
- BACKTO = minit
-
- while True:
- if BACKTO is "MM":
- BACKTO = _init_sub("1", "Q", "MM", "main_f", CWORKDIR)
-
- elif BACKTO is "DOC":
- BACKTO = _init_sub("2", "MM", "DOC", "doc_f", CWORKDIR)
-
- elif BACKTO is "AB":
- BACKTO = _init_sub("3", "MM", "DOC", "about_f", CWORKDIR)
-
- elif BACKTO is "PORT_M":
- BACKTO = _init_sub("7", "SM", "PORT_M", "portage_men_f", CCONFDIR)
-
- elif BACKTO is "CAT_M":
- BACKTO = _init_sub("10", "SM", "CATA_M", "catalyst_f", CCONFDIR)
-
- elif BACKTO is "SM":
- BACKTO = _init_sub("6", "BSM", "SM", "bs_f", CWORKDIR)
-
- elif BACKTO is "BSM":
- BACKTO = _init_sub("5", "MM", "BSM", "bs_menu_f", CWORKDIR)
-
- elif BACKTO is "CO_F":
- BACKTO = _init_sub("8", "BSM", "CO_F", "config_f", CCONFDIR)
-
- elif BACKTO is "SELDEF":
- BACKTO = _init_sub("9", "BSM", "SELDEF", "selectdef_f", CWORKDIR)
-
- elif BACKTO is "GSET":
- BACKTO = _init_sub("11", "MM", "GSET", "gse_t", CWORKDIR)
-
- elif BACKTO is "CONTR":
- BACKTO = _init_sub('', "MM", "CONTR", "controller_f", CWORKDIR)
-
- elif BACKTO is "Q":
- break
-
-
- _main_loop("MM", CWORKDIR, CFUNCTIONS, CCONFDIR, CDISTDIR)
-
- return 0
-
-
-