diff --git a/README.rst b/README.rst index 36ec11822262bb296209cfeb6633c78415729b0b..04436a823feeb55ebf602b5281503420a31cafad 100644 --- a/README.rst +++ b/README.rst @@ -40,7 +40,8 @@ On Linux ./build.py --dependencies -Your distribution's package manager will be used. +Your distribution's package manager will be used. Adding the ``-y`` flag will install the +dependencies non-interactively (assumes yes at all prompts). 2. Build and install locally under this repository: diff --git a/build.py b/build.py index 93ab91b88fbe5800e09610df11abea7c252ae971..06dbe5930cf630913a01af98bf648c23ee60b7a3 100755 --- a/build.py +++ b/build.py @@ -51,7 +51,7 @@ FLATPAK_BASED_RUNTIMES = [ APT_INSTALL_SCRIPT = [ 'apt-get update', - 'apt-get install -y %(packages)s' + 'apt-get install %(packages)s' ] BREW_UNLINK_SCRIPT = [ @@ -66,7 +66,7 @@ BREW_INSTALL_SCRIPT = [ RPM_INSTALL_SCRIPT = [ 'dnf update', - 'dnf install -y %(packages)s' + 'dnf install %(packages)s' ] PACMAN_INSTALL_SCRIPT = [ @@ -76,7 +76,7 @@ PACMAN_INSTALL_SCRIPT = [ ZYPPER_INSTALL_SCRIPT = [ 'zypper update', - 'zypper install -y %(packages)s' + 'zypper install %(packages)s' ] ZYPPER_DEPENDENCIES = [ @@ -253,6 +253,9 @@ OSX_UNINSTALL_SCRIPT = [ 'rm -rf install/client-macosx' ] +ASSUME_YES_FLAG = ' -y' +ASSUME_YES_FLAG_PACMAN = ' --noconfirm' + def run_powersell_cmd(cmd): p = subprocess.Popen(["powershell.exe", cmd], stdout=sys.stdout) p.communicate() @@ -266,6 +269,9 @@ def run_dependencies(args): 'Set-ExecutionPolicy Unrestricted; .\\scripts\\install-deps-windows.ps1') elif args.distribution in APT_BASED_DISTROS: + if args.assume_yes: + for i, _ in enumerate(APT_INSTALL_SCRIPT): + APT_INSTALL_SCRIPT[i] += ASSUME_YES_FLAG execute_script( APT_INSTALL_SCRIPT, {"packages": ' '.join(map(shlex.quote, APT_DEPENDENCIES))}) @@ -281,6 +287,9 @@ def run_dependencies(args): {"packages": ' '.join(map(shlex.quote, APT_CLIENT_GNOME_DEPENDENCIES))}) elif args.distribution in DNF_BASED_DISTROS: + if args.assume_yes: + for i, _ in enumerate(DNF_INSTALL_SCRIPT): + DNF_INSTALL_SCRIPT[i] += ASSUME_YES_FLAG execute_script( RPM_INSTALL_SCRIPT, {"packages": ' '.join(map(shlex.quote, DNF_DEPENDENCIES))}) @@ -296,6 +305,9 @@ def run_dependencies(args): {"packages": ' '.join(map(shlex.quote, DNF_CLIENT_GNOME_DEPENDENCIES))}) elif args.distribution in PACMAN_BASED_DISTROS: + if args.assume_yes: + for i, _ in enumerate(PACMAN_INSTALL_SCRIPT): + PACMAN_INSTALL_SCRIPT[i] += ASSUME_YES_FLAG_PACMAN execute_script( PACMAN_INSTALL_SCRIPT, {"packages": ' '.join(map(shlex.quote, PACMAN_DEPENDENCIES))}) @@ -311,6 +323,9 @@ def run_dependencies(args): {"packages": ' '.join(map(shlex.quote, PACMAN_CLIENT_GNOME_DEPENDENCIES))}) elif args.distribution in ZYPPER_BASED_DISTROS: + if args.assume_yes: + for i, _ in enumerate(ZYPPER_INSTALL_SCRIPT): + ZYPPER_INSTALL_SCRIPT[i] += ASSUME_YES_FLAG execute_script( ZYPPER_INSTALL_SCRIPT, {"packages": ' '.join(map(shlex.quote, ZYPPER_DEPENDENCIES))}) @@ -710,6 +725,8 @@ def parse_args(): ap.add_argument('--no-libwrap', dest='no_libwrap', default=False, action='store_true', help='Disable libwrap. Also set --disable-shared option to daemon configure') + ap.add_argument('-y', '--assume-yes', default=False, action='store_true', + help='Assume yes (do not prompt user) for dependency installations through the system package manager') ap.add_argument('--no-webengine', dest='no_webengine', default=False, action='store_true', help='Do not use Qt WebEngine.')