Fixes in scripts for fedora derivatives

This commit is contained in:
absurdo 2023-12-01 23:53:14 +01:00
parent 092a4ee969
commit 4dd7e4531f
4 changed files with 16 additions and 14 deletions

View file

@ -10,9 +10,11 @@ $conf_vhosts="IncludeOptional vhosts.d/*.conf";
Linux::json_log('Installing Apache server', $error=0, $status=0, $progress=0, $no_progress=1);
$redhat_package='mod_ssl openssl tar socat policycoreutils-python-utils wget';
$debian_package='apache2 logrotate socat curl';
$linux_package=['debian' => 'apache2 logrotate socat curl', 'ubuntu' => 'apache2 logrotate socat curl', 'fedora' => $redhat_package, 'almalinux' => $redhat_package, 'rocky' => $redhat_package, 'arch' => 'apache'];
$redhat_package='httpd mod_ssl openssl tar socat policycoreutils-python-utils wget';
$linux_package=['debian' => $debian_package, 'ubuntu' => $debian_package, 'fedora' => $redhat_package, 'almalinux' => $redhat_package, 'rocky' => $redhat_package, 'arch' => 'apache'];
Linux::install_package($linux_package);

View file

@ -52,7 +52,7 @@ if linux_distro=='arch':
php_command='/usr/bin/php-legacy'
if linux_distro=='fedora' or linux_distro=='rocky':
if linux_distro=='fedora' or linux_distro=='rocky' or linux_distro=='almalinux':
php_command='/usr/bin/php'+args.php_version.replace('.', '')
@ -117,7 +117,7 @@ if os.path.isfile(home_user+'/index.php'):
print('Installing Wordpress...')
if subprocess.call("sudo su %s -s /bin/bash -c '%s %s core download'" % (user, php_command, wp_command), shell=True) > 0:
print('Error')
print("Error: %s %s core download\n" % (php_command, wp_command))
sys.exit(1)
mysql_user=args.user_mysql
@ -128,7 +128,7 @@ host_db=args.server_mysql
if args.port_mysql!=3306:
host_db=host_db+':'+str(args.port_mysql)
if subprocess.call("sudo su %s -s /bin/bash -c '%s %s config create --dbname=%s --dbuser=%s --dbpass=%s --dbhost=%s'" % (user, php_command, wp_command, args.db_mysql, mysql_user, mysql_password, host_db), shell=True) > 0:
if subprocess.call("sudo su %s -s /bin/bash -c '%s %s config create --dbname=%s --dbuser=%s --dbpass=\"%s\" --dbhost=%s'" % (user, php_command, wp_command, args.db_mysql, mysql_user, mysql_password, host_db), shell=True) > 0:
print('Error')
sys.exit(1)
@ -136,7 +136,7 @@ print('Created basic config...')
# Add cronjob for wordpress
if subprocess.call("sudo su %s -s /bin/bash -c '%s %s core install --url=%s --title=\"%s\" --admin_user=%s --admin_password=%s --admin_email=%s'" % (user, php_command, wp_command, args.domain+args.path, args.title, args.user, args.password, args.email), shell=True) > 0:
if subprocess.call("sudo su %s -s /bin/bash -c '%s %s core install --url=%s --title=\"%s\" --admin_user=%s --admin_password=\"%s\" --admin_email=%s'" % (user, php_command, wp_command, args.domain+args.path, args.title, args.user, args.password, args.email), shell=True) > 0:
print('Error: cannot install wordpress')
sys.exit(1)
else:

View file

@ -6,7 +6,7 @@ include('leviathanutils/vendor/autoload.php');
$user=get_current_user();
$file_wp='./bin/wp';
$file_wp='/usr/local/bin/wp';
Linux::json_log('Installing WP Wordpress utility...', $error=0, $status=0, $progress=0, $no_progress=1);
@ -14,20 +14,20 @@ if(is_file($file_wp)) {
Linux::json_log('Installed, updating wp...', $error=0, $status=0, $progress=0, $no_progress=1);
Linux::shell_command(['./bin/wp cli update --yes']);
Linux::shell_command(["sudo ${file_wp} cli update --yes"]);
}
else {
/*
if(!is_dir('./bin')) {
mkdir('./bin');
}
}*/
Linux::shell_command(['curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar']);
Linux::shell_command(['chmod +x wp-cli.phar']);
Linux::shell_command(["mv wp-cli.phar ./bin/wp && sudo ln -s /home/${user}/bin/wp /usr/local/bin/wp"]);
Linux::shell_command(["sudo mv wp-cli.phar /usr/local/bin/wp"]);
}

View file

@ -154,9 +154,9 @@ class ServerTask(WebAppTask):
#self.commands_to_execute.append(['modules/webservers/scripts/add_php_vhost.py', '--user=%s --php_version=8.2 --domain=%s' % (self.data['username'], self.data['domain_wp']), 'sudo'])
install_wordpress='--home_user=%s --user=%s --password=%s --email=%s --domain=%s --title="%s" --db_mysql=%s --user_mysql=%s --password_mysql=%s --server_mysql=%s --port_mysql=%i --path=%s --php_version=%s' % (self.data['home'], self.data['user_wp'], self.data['password_wp'], self.data['email_wp'], self.data['domain_wp'], self.data['title_wp'], self.data['mysql_db'], self.data['mysql_user'], self.data['mysql_password'], self.data['mysql_host'], 3306, self.data['path'], arr_virtualhost['php'])
install_wordpress='--home_user=%s --user=%s --password="%s" --email=%s --domain=%s --title="%s" --db_mysql=%s --user_mysql=%s --password_mysql="%s" --server_mysql="%s" --port_mysql=%i --path=%s --php_version=%s' % (self.data['home'], self.data['user_wp'], self.data['password_wp'], self.data['email_wp'], self.data['domain_wp'], self.data['title_wp'], self.data['mysql_db'], self.data['mysql_user'], self.data['mysql_password'], self.data['mysql_host'], 3306, self.data['path'], arr_virtualhost['php'])
#print(install_wordpress)
print(install_wordpress)
self.commands_to_execute.append(['modules/apache/scripts/webapps/wordpress/install_wordpress_site.py', install_wordpress])