Charles K.'s picture

I am working on updating the patch that adds McMyAdmin.com located here:  http://www.turnkeylinux.org/forum/general/20110821/tklpatch-unofficial-m...

so that it will work with the current version of tklcore and give the option to install JAVA 1.7

I am having an issue trying to get the inithook to run a bash shell script. Here is a snippet of my code. Once the bash shell script has ran I want it to come back to the interactive screen like it does when updates are installed. 

oracle-ask.py file

#!/usr/bin/python
# Copyright (c) 2010 Alon Swartz <alon@turnkeylinux.org>
"""Accept Oracle Licence Agreement"""

import sys
import getopt
import signal

from executil import ExecError, getoutput, system
from dialog_wrapper import Dialog

TEXT = """Do you accept the Oracle Binary Code License Agreement for Java SE located here:

http://www.oracle.com/technetwork/java/javase/terms/license/index.html


If not accepted, Default-JDK will be installed instead.

This can take a few minutes. You need to be online.
"""

CONNECTIVITY_ERROR = """Unable to connect to package archive.

Please try again once your network settings are configured by using the following shell command (output will be available in /var/log/cron-apt/log):

    turnkey-init
"""


TEXT2 = """    if [ -d /usr/lib/jvm ]
    then
        echo "/usr/lib/jvm directory  exists!"
    else
        echo "/usr/lib/jvm directory not found!"
        echo "Creating directory now."
        mkdir /usr/lib/jvm
    fi
"""

 

def usage(s=None):
    if s:
        print >> sys.stderr, "Error:", s
    print >> sys.stderr, "Syntax: %s [options]" % sys.argv[0]
    print >> sys.stderr, __doc__
    sys.exit(1)

def main():
    signal.signal(signal.SIGINT, signal.SIG_IGN)
    try:
        opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ['help'])
    except getopt.GetoptError, e:
        usage(e)

    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()

    d = Dialog("TurnKey Linux - First boot configuration")
    accept = d.yesno("Accept Oracle Licence Agreement", TEXT, "Accept", "Skip")

    if not accept:
        sys.exit(1)

    try:

       getoutput("/usr/bin/sh /root/install-java167.sh")
    except ExecError, e:
        d.error(CONNECTIVITY_ERROR)
        sys.exit(1)

 

#
#       getoutput("host -W 2 archive.turnkeylinux.org")
#    except ExecError, e:
#        d.error(CONNECTIVITY_ERROR)
#        sys.exit(1)
#

if __name__ == "__main__":
    main()

 

Forum: 

Add new comment