mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-29 10:10:19 +00:00
action_utils: Introduce utility for setting debconf answers
Tests: mldonkey - Installs - /etc/default/mldonkey-server has LAUNCH_AT_STARTUP=true - systemctl status mldonkey-server shows daemon running ejabberd - Installs - /etc/ejabberd/ejabberd.yml has domainname properly configured privoxy - Installs - /etc/privoxy/config has listen-address set to '[::]:8118' roundcube - Installs and works - /etc/roundcube/debian-db.php contains dbtype sqlite3 ttrss - Installs and works - /etc/ttrss/database.php has dbtype 'pgsql'. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
12cf790dcd
commit
ca8ea9427c
@ -129,21 +129,20 @@ def subcommand_disable_user_registrations(_):
|
|||||||
def subcommand_pre_install(_):
|
def subcommand_pre_install(_):
|
||||||
"""Pre installation configuration for diaspora"""
|
"""Pre installation configuration for diaspora"""
|
||||||
presets = [
|
presets = [
|
||||||
b'diaspora-common diaspora-common/url string dummy_domain_name',
|
'diaspora-common diaspora-common/url string dummy_domain_name',
|
||||||
b'diaspora-common diaspora-common/dbpass note ',
|
'diaspora-common diaspora-common/dbpass note ',
|
||||||
b'diaspora-common diaspora-common/enablessl boolean false',
|
'diaspora-common diaspora-common/enablessl boolean false',
|
||||||
b'diaspora-common diaspora-common/useletsencrypt string false',
|
'diaspora-common diaspora-common/useletsencrypt string false',
|
||||||
b'diaspora-common diaspora-common/services multiselect ',
|
'diaspora-common diaspora-common/services multiselect ',
|
||||||
b'diaspora-common diaspora-common/ssl boolean false',
|
'diaspora-common diaspora-common/ssl boolean false',
|
||||||
b'diaspora-common diaspora-common/pgsql/authmethod-admin string ident',
|
'diaspora-common diaspora-common/pgsql/authmethod-admin string ident',
|
||||||
b'diaspora-common diaspora-common/letsencrypt boolean false',
|
'diaspora-common diaspora-common/letsencrypt boolean false',
|
||||||
b'diaspora-common diaspora-common/remote/host string localhost',
|
'diaspora-common diaspora-common/remote/host string localhost',
|
||||||
b'diaspora-common diaspora-common/database-type string pgsql',
|
'diaspora-common diaspora-common/database-type string pgsql',
|
||||||
b'diaspora-common diaspora-common/dbconfig-install boolean true'
|
'diaspora-common diaspora-common/dbconfig-install boolean true'
|
||||||
]
|
]
|
||||||
|
|
||||||
for preset in presets:
|
action_utils.debconf_set_selections(presets)
|
||||||
subprocess.check_output(['debconf-set-selections'], input=preset)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@ -100,9 +100,8 @@ def subcommand_pre_install(arguments):
|
|||||||
# If new domainname is blank, use hostname instead.
|
# If new domainname is blank, use hostname instead.
|
||||||
domainname = socket.gethostname()
|
domainname = socket.gethostname()
|
||||||
|
|
||||||
subprocess.check_output(
|
action_utils.debconf_set_selections(
|
||||||
['debconf-set-selections'],
|
['ejabberd ejabberd/hostname string ' + domainname])
|
||||||
input=b'ejabberd ejabberd/hostname string ' + domainname.encode())
|
|
||||||
|
|
||||||
|
|
||||||
def subcommand_setup(arguments):
|
def subcommand_setup(arguments):
|
||||||
|
|||||||
@ -21,7 +21,8 @@ Configuration helper for mldonkey.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import subprocess
|
|
||||||
|
from plinth import action_utils
|
||||||
|
|
||||||
|
|
||||||
def parse_arguments():
|
def parse_arguments():
|
||||||
@ -37,9 +38,8 @@ def parse_arguments():
|
|||||||
|
|
||||||
def subcommand_pre_install(_):
|
def subcommand_pre_install(_):
|
||||||
"""Preseed debconf values before packages are installed."""
|
"""Preseed debconf values before packages are installed."""
|
||||||
subprocess.check_output([
|
action_utils.debconf_set_selections(
|
||||||
'debconf-set-selections'
|
['mldonkey-server mldonkey-server/launch_at_startup boolean true'])
|
||||||
], input=b'mldonkey-server mldonkey-server/launch_at_startup boolean true')
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@ -15,13 +15,13 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Configuration helper for Privoxy server.
|
Configuration helper for Privoxy server.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import subprocess
|
|
||||||
|
from plinth import action_utils
|
||||||
|
|
||||||
|
|
||||||
def parse_arguments():
|
def parse_arguments():
|
||||||
@ -39,10 +39,8 @@ def parse_arguments():
|
|||||||
|
|
||||||
def subcommand_pre_install(_):
|
def subcommand_pre_install(_):
|
||||||
"""Preseed debconf values before packages are installed."""
|
"""Preseed debconf values before packages are installed."""
|
||||||
subprocess.run(
|
action_utils.debconf_set_selections(
|
||||||
['debconf-set-selections'],
|
['privoxy privoxy/listen-address string [::]:8118'])
|
||||||
input=b'privoxy privoxy/listen-address string [::]:8118',
|
|
||||||
check=True)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@ -21,7 +21,6 @@ Configuration helper for Roundcube server.
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import re
|
import re
|
||||||
import subprocess
|
|
||||||
|
|
||||||
from plinth import action_utils
|
from plinth import action_utils
|
||||||
|
|
||||||
@ -44,12 +43,10 @@ def parse_arguments():
|
|||||||
|
|
||||||
def subcommand_pre_install(_):
|
def subcommand_pre_install(_):
|
||||||
"""Preseed debconf values before packages are installed."""
|
"""Preseed debconf values before packages are installed."""
|
||||||
subprocess.check_output(
|
action_utils.debconf_set_selections([
|
||||||
['debconf-set-selections'],
|
'roundcube-core roundcube/dbconfig-install boolean true',
|
||||||
input=b'roundcube-core roundcube/dbconfig-install boolean true')
|
'roundcube-core roundcube/database-type string sqlite3'
|
||||||
subprocess.check_output(
|
])
|
||||||
['debconf-set-selections'],
|
|
||||||
input=b'roundcube-core roundcube/database-type string sqlite3')
|
|
||||||
|
|
||||||
|
|
||||||
def subcommand_setup(_):
|
def subcommand_setup(_):
|
||||||
|
|||||||
@ -51,8 +51,8 @@ def parse_arguments():
|
|||||||
|
|
||||||
def subcommand_pre_setup(_):
|
def subcommand_pre_setup(_):
|
||||||
"""Preseed debconf values before packages are installed."""
|
"""Preseed debconf values before packages are installed."""
|
||||||
subprocess.check_output(['debconf-set-selections'],
|
action_utils.debconf_set_selections(
|
||||||
input=b'tt-rss tt-rss/database-type string pgsql')
|
['tt-rss tt-rss/database-type string pgsql'])
|
||||||
|
|
||||||
|
|
||||||
def subcommand_setup(_):
|
def subcommand_setup(_):
|
||||||
|
|||||||
@ -529,6 +529,12 @@ Owners: {package}
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def debconf_set_selections(presets):
|
||||||
|
"""Answer debconf questions before installing a package."""
|
||||||
|
presets = '\n'.join(presets)
|
||||||
|
subprocess.check_output(['debconf-set-selections'], input=presets.encode())
|
||||||
|
|
||||||
|
|
||||||
def is_disk_image():
|
def is_disk_image():
|
||||||
"""Return whether the current machine is from a disk image.
|
"""Return whether the current machine is from a disk image.
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user