diff --git a/bin/kano-updater-internal b/bin/kano-updater-internal index c303080e..85ec9576 100755 --- a/bin/kano-updater-internal +++ b/bin/kano-updater-internal @@ -68,7 +68,7 @@ from kano_updater.status import UpdaterStatus from kano_updater.utils import make_low_prio, is_running, \ remove_pid_file, pause_notifications, resume_notifications, show_kano_dialog, \ run_bg, enable_power_button, disable_power_button, verify_kit_is_plugged, \ - clear_tracking_uuid + clear_tracking_uuid, detach_from_tty from kano_updater.return_codes import RC, RCState import kano_updater.priority as Priority @@ -184,6 +184,9 @@ def main(): msg = _('Administrator priviledges are required to perform this operation') enforce_root(u"{}: {}".format(_('ERROR'), msg)) + # Detach from tty to avoid packages trying to run interactive commands + detach_from_tty() + args = docopt.docopt(__doc__, version=str(get_target_version())) _g_gui_mode = args['--gui'] _g_keep_uuid = args['--keep-uuid'] diff --git a/debian/changelog b/debian/changelog index 781669c6..377d4853 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,8 +4,9 @@ kano-updater (4.0.0-0) unstable; urgency=low * Fix GTK compatibility for Stretch release * Add support for CKT * Support expanding the filesystem of images with recovery partitions + * Detach from tty to avoid interactive package installs - -- Team Kano Thu, 23 Apr 2018 11:48:00 +0100 + -- Team Kano Fri, 6 Jul 2018 11:48:00 +0100 kano-updater (3.15.0-0) unstable; urgency=low diff --git a/kano_updater/utils.py b/kano_updater/utils.py index 431d6468..88a610ce 100644 --- a/kano_updater/utils.py +++ b/kano_updater/utils.py @@ -14,6 +14,8 @@ import grp import signal import traceback +import fcntl +import termios from kano.logging import logger from kano.utils.shell import run_cmd, run_bg, run_cmd_log @@ -625,3 +627,16 @@ def clear_tracking_uuid(): remove_tracking_uuid(TRACKING_UUID_KEY) except: logger.error('Unexpected error:\n{}'.format(traceback.format_exc())) + + +def detach_from_tty(): + """ + Detach from controlling tty + """ + try: + myTTY = os.open("/dev/tty", os.O_RDWR) + + fcntl.ioctl(myTTY, termios.TIOCNOTTY, 0) + os.close(myTTY) + except: + logger.error("Failed to close controlling terminal")