Commit bde4a069 authored by Tails developers's avatar Tails developers
Browse files

Merge branch 'feature/consistent-peristence-path' into stable

parents 570d4114 20ff822f
......@@ -2,14 +2,13 @@
import gettext
import syslog
import glob
import os.path
import sys
import subprocess
PACKAGES_LIST_FILE= PERSISTENCE_DIR + "/live-additional-software.conf"
def _launch_apt_get(specific_args):
"""Launch apt-get with given args
......@@ -59,34 +58,31 @@ def _notify(title, body):
syslog.syslog(syslog.LOG_WARNING, "Warning: unable to notify the user. %s" % e)
syslog.syslog(syslog.LOG_WARNING, "The notification was: %s %s" % (title, body))
def get_additional_packages_lists():
"""Returns the paths of additional packageslists
def has_additional_packages_list():
"""Return true iff PACKAGES_LIST_FILE exists
syslog.syslog("Reading additional packages list")
packages_list = []
for persistent_dir in glob.glob(UNLOCKED_PERSISTENCE_DIRS_GLOB):
if os.path.isfile(persistent_dir + PACKAGES_LIST_FILE):
syslog.syslog("Found additional packages list in %s" % persistent_dir)
packages_list.append(persistent_dir + PACKAGES_LIST_FILE)
return packages_list
return os.path.isfile(PACKAGES_LIST_FILE)
def get_additional_packages():
"""Returns the list of all the additional packages
if not has_additional_packages_list():
return None
packages = []
for package_list in get_additional_packages_lists():
with open(package_list) as f:
for line in f:
line = line.strip()
if line: packages.append(line)
with open(PACKAGES_LIST_FILE) as f:
for line in f:
line = line.strip()
if line: packages.append(line)
return packages
def install_additional_packages():
"""The subcommand which activates and installs all additional packages
syslog.syslog("Starting to install additional software...")
if not get_additional_packages_lists():
if has_additional_packages_list():
syslog.syslog("Found additional packages list")
syslog.syslog(syslog.LOG_WARNING, "Warning: no additional software configured, exiting.")
return True
packages = get_additional_packages()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment