diff --git a/README.md b/README.md index 7fef54b..2ec8be5 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Maybe for those who are used to doing everything for the terminal, they don't ca
-# ⚈ How to get start +# ⚈ How to get started

Download the deb version available here https://github.com/CleoMenezes/LAMPP-Manager/releases/tag/v0.0.2), it is currently available only in deb. In the future I think about migrating to Flatpak. Install via your package installer probably just by opening the file. Install it as you normally do with any other program. When the installation is finished, no other process is necessary. diff --git a/configuration files/000-default.conf b/configuration files/000-default.conf index c69adad..6b3ed0c 100644 --- a/configuration files/000-default.conf +++ b/configuration files/000-default.conf @@ -29,6 +29,9 @@ # vim: syntax=apache ts=4 sw=4 sts=4 sr noet - - AllowOverride All + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + allow from all diff --git a/install/install.sh b/install/install.sh index 84827d5..534ebd3 100755 --- a/install/install.sh +++ b/install/install.sh @@ -4,11 +4,16 @@ echo '#################### Welcome LAMPP Manager install ####################' echo ; echo ; echo echo '>> This script will install everything you need to have LAMPP on your computer.' sudo apt install wget +sudo apt update echo ; echo ; echo echo '#################### Now lets install Apache2 ####################' echo ; echo ; echo -sudo apt install apache2 -y +sudo apt purge -y apache2 && sudo apt install -y apache2 +echo ; echo ; echo +echo '#################### Lets set permission to html folder. ####################' +sudo chmod 777 -R /var/www/html echo ; echo ; echo + echo '>> Take a look if you installed correctly by accessing localhost.' echo ; echo ; echo sensible-browser localhost @@ -31,9 +36,9 @@ echo '>> We will also install php-fpm, php-gd, php-curl, php-mysql and libapache echo ; echo ; echo sudo apt install php php-fpm php-gd php-curl php-mysql libapache2-mod-php -y echo 'Check if PHP has been installed correctly' -wget https://github.com/CleoMenezes/LAMPP-Manager/blob/master/configuration%20files/info.php -sudo mv info.php /var/www/html/ -sensible-browser http://localhost/info.php +#wget https://github.com/CleoMenezes/LAMPP-Manager/blob/master/configuration%20files/info.php +#sudo mv info.php /var/www/html/ +#sensible-browser http://localhost/info.php echo ; echo ; echo echo '>> I suppose you will also need optimized settings for Wordpress.' echo ; echo ; echo @@ -46,8 +51,8 @@ echo ; echo ; echo echo '#################### Optimal settings in the php.ini file. ####################' echo ; echo ; echo -wget https://github.com/CleoMenezes/LAMPP-Manager/blob/master/configuration%20files/000-default.conf -sudo mv 000-default.conf /etc/apache2/sites-available/ +#wget https://github.com/CleoMenezes/LAMPP-Manager/blob/master/configuration%20files/000-default.conf +#sudo mv 000-default.conf /etc/apache2/sites-available/ echo ; echo ; echo echo '#################### Lets install phpMyAdmin. ####################' echo ; echo ; echo @@ -73,8 +78,8 @@ sudo chown -R www-data:www-data /usr/share/phpmyadmin echo ; echo ; echo echo -e '>> It is ideal that you create the phpMyAdmin database and assign it to our user as in the example below. You can do later:\n\nsudo mysql -u root -p\nCREATE DATABASE phpmyadmin;\nGRANT ALL PRIVILEGES ON phpmyadmin.* TO your_username;\n FLUSH PRIVILEGES;.' echo ; echo ; echo -wget https://github.com/CleoMenezes/LAMPP-Manager/blob/master/configuration%20files/phpmyadmin.conf -sudo mv phpmyadmin.conf /etc/apache2/conf-available/ +#wget https://github.com/CleoMenezes/LAMPP-Manager/blob/master/configuration%20files/phpmyadmin.conf +#sudo mv phpmyadmin.conf /etc/apache2/conf-available/ echo ; echo ; echo echo '>> Lets enable the snippet for the configuration' echo ; echo ; echo @@ -96,9 +101,13 @@ echo '#################### Lets install VSFTP. ####################' echo ; echo ; echo sudo apt-get install vsftpd echo ; echo ; echo -echo '#################### Lets set permission to html folder. ####################' -sudo chmod 777 -R /var/www/html -echo ; echo ; echo -sleep 3; -echo 'Enjoy!'; +sudo apt-get -o DPkg::Options::="--force-confmiss" --reinstall install apache2 -y +sudo apt purge apache2 -y +sudo apt install apache2 -y +sudo apt purge libapache2-mod-php -y +sudo apt install libapache2-mod-php -y + + +echo ; echo ; echo; echo ; echo ; echo +echo 'Restart LAMPP Manager and Enjoy!' diff --git a/interface.glade b/interface.glade index b3994d0..3bbff51 100644 --- a/interface.glade +++ b/interface.glade @@ -528,7 +528,7 @@ - + True False . @@ -639,7 +639,7 @@ - + True False gtk-missing-image @@ -675,7 +675,7 @@ - + True False - diff --git a/main.py b/main.py index 416394e..ee91c83 100755 --- a/main.py +++ b/main.py @@ -28,15 +28,16 @@ def __init__(self, *args, **kwargs): self.button_restart_all = builder.get_object('button_restart_all') self.button_p_start = builder.get_object('button_p_start') self.button_p_stop = builder.get_object('button_p_stop') - self.proftp_status = builder.get_object('proftp_status') + self.ftpd_status = builder.get_object('ftpd_status') self.button_p_stop = builder.get_object('button_p_stop') self.button_p_restart = builder.get_object('button_p_restart') self.about = builder.get_object('about') self.apache_port = builder.get_object('apache_port') self.mysql_port = builder.get_object('mysql_port') + self.ftp_port = builder.get_object('ftp_port') self.apache_img_status = builder.get_object('apache_img_status') self.mysql_img_status = builder.get_object('mysql_img_status') - self.ftp_img_status = builder.get_object('ftp_img_status') + self.ftpd_img_status = builder.get_object('ftpd_img_status') @@ -50,7 +51,6 @@ def __init__(self, *args, **kwargs): text_file = apache_port_file.readlines() #b_port_status = self.apache_port.get_label() self.apache_port.set_text(str(text_file[4].replace('Listen', '').strip())) - print('gostosinha') except: pass @@ -66,6 +66,11 @@ def __init__(self, *args, **kwargs): pass +#putting current ftp's port + self.ftp_port.set_text('2121') #Thats the default + + + #putting current status of apacher service WORKING @@ -139,21 +144,37 @@ def __init__(self, *args, **kwargs): self.mysql_img_status.set_from_icon_name('emblem-important', 1) -#putting current status of proftp service - p_first_status = self.proftp_status.get_label() - if str(p_first_status) != 'Active' or str(p_first_status) != 'Inactive': - try: +#putting current status of ftp service - status_command = os.popen('pkexec /opt/lampp/lampp status').readlines() - if 'ProFTPD is deactivated' in str(status_command[3]) or 'ProFTPD is not running' in str(status_command[3]): - self.proftp_status.set_text('Inactive') - self.ftp_img_status.set_from_icon_name('emblem-unreadable', 1) - elif 'ProFTPD is running' in str(status_command[3]): - self.proftp_status.set_text('Active') - self.ftp_img_status.set_from_icon_name('emblem-default', 1) - except: - self.proftp_status.set_text('Not found') - self.ftp_img_status.set_from_icon_name('emblem-important', 1) + + status_command_p = os.popen('service vsftpd status').readlines() + p_first_status = self.ftpd_status.get_label() + if str(p_first_status) != 'Active' or str(p_first_status) != 'Inactive': + try: + try: + if status_command_p[0][0] == '●': + if 'dead' in str(status_command_p[2]): + self.ftpd_status.set_text('Inactive') + self.ftpd_img_status.set_from_icon_name('emblem-unreadable', 1) + + elif 'running' in str(status_command_m[2]): + self.ftpd_status.set_text('Active') + self.ftpd_img_status.set_from_icon_name('emblem-default', 1) + + + except: + if 'sudo' not in os.popen('sudo /opt/lampp/lampp status').readlines()[0]: + status_command = os.popen('pkexec /opt/lampp/lampp status').readlines() + if 'ProFTPD is deactivated' in str(status_command[3]) or 'ProFTPD is not running' in str(status_command[3]): + self.ftpd_status.set_text('Inactive') + self.ftpd_img_status.set_from_icon_name('emblem-unreadable', 1) + elif 'ProFTPD is running' in str(status_command[3]): + self.ftpd_status.set_text('Active') + self.ftpd_img_status.set_from_icon_name('emblem-default', 1) + + except IndexError: + self.ftpd_status.set_text('Not found') + self.ftpd_img_status.set_from_icon_name('emblem-important', 1) ################################################################################ @@ -348,61 +369,96 @@ def on_button_m_restart_clicked(self, *args): ########################################## ProFTPD BUTTON ################################################ -#start ProFTPD button +#start FTPD button def on_button_p_start_clicked(self, *args): + try: - try: - if 'sudo' not in os.popen('sudo systemctl status proftpd').readlines()[0]: - os.system('') - + try: + if 'Cannot run program' not in os.popen('service vsftpd status').readlines()[0]: + os.system('service vsftpd start') + status_command = os.popen('service vsftpd status').readlines() + if 'dead' in str(status_command[2]): + self.ftpd_status.set_text('Inactive') + self.ftpd_img_status.set_from_icon_name('emblem-unreadable', 1) + elif 'running' in str(status_command[2]): + self.ftpd_status.set_text('Active') + self.ftpd_img_status.set_from_icon_name('emblem-default', 1) except: - if 'sudo' not in os.popen('sudo /opt/lampp/lampp status').readlines()[0]: - os.popen('sudo /opt/lampp/lampp startftp') - status_command = os.popen('sudo /opt/lampp/lampp status').readlines() - if 'ProFTPD is deactivated' in str(status_command[3]) or 'ProFTPD is not running' in str(status_command[3]): - self.proftp_status.set_text('Inactive') - self.ftp_img_status.set_from_icon_name('emblem-unreadable', 1) - elif 'ProFTPD is running' in str(status_command[3]): - self.proftp_status.set_text('Active') - self.ftp_img_status.set_from_icon_name('emblem-default', 1) - + if 'sudo' not in os.popen('sudo /opt/lampp/lampp status').readlines()[0]: + os.popen('sudo /opt/lampp/lampp startftp') + status_command = os.popen('sudo /opt/lampp/lampp status').readlines() + if 'ProFTPD is deactivated' in str(status_command[3]) or 'ProFTPD is not running' in str(status_command[3]): + self.ftpd_status.set_text('Inactive') + self.ftpd_img_status.set_from_icon_name('emblem-unreadable', 1) + elif 'ProFTPD is running' in str(status_command[3]): + self.ftpd_status.set_text('Active') + self.ftpd_img_status.set_from_icon_name('emblem-default', 1) except: - self.proftp_status.set_text('Cannot connect') - self.ftp_img_status.set_from_icon_name('emblem-important', 1) + self.ftpd_status.set_text('Cannot connect') + self.ftpd_img_status.set_from_icon_name('emblem-important', 1) + #stop ProFTPD button def on_button_p_stop_clicked(self, *args): + try: - if 'sudo' not in os.popen('sudo /opt/lampp/lampp status').readlines()[0]: - os.popen('sudo /opt/lampp/lampp stopftp') - status_command = os.popen('sudo /opt/lampp/lampp status').readlines() - if 'ProFTPD is deactivated' in str(status_command[3]) or 'ProFTPD is not running' in str(status_command[3]): - self.proftp_status.set_text('Inactive') - self.ftp_img_status.set_from_icon_name('emblem-unreadable', 1) - elif 'ProFTPD is running' in str(status_command[3]): - self.proftp_status.set_text('Active') - self.ftp_img_status.set_from_icon_name('emblem-default', 1) + try: + if 'Cannot run program' not in os.popen('service vsftpd status').readlines()[0]: + os.system('service vsftpd stop') + status_command = os.popen('service vsftpd status').readlines() + + if 'running' in str(status_command[2]): + self.ftpd_status.set_text('Active') + self.ftpd_img_status.set_from_icon_name('emblem-default', 1) + elif 'dead' in str(status_command[2]): + self.ftpd_status.set_text('Inactive') + self.ftpd_img_status.set_from_icon_name('emblem-unreadable', 1) + else: + self.ftpd_status.set_text('Cannot connect') + except: + if 'sudo' not in os.popen('sudo /opt/lampp/lampp status').readlines()[0]: + os.popen('sudo /opt/lampp/lampp stopftp') + status_command = os.popen('sudo /opt/lampp/lampp status').readlines() + if 'ProFTPD is deactivated' in str(status_command[3]) or 'ProFTPD is not running' in str(status_command[3]): + self.ftpd_status.set_text('Inactive') + self.ftpd_img_status.set_from_icon_name('emblem-unreadable', 1) + elif 'ProFTPD is running' in str(status_command[3]): + self.ftpd_status.set_text('Active') + self.ftpd_img_status.set_from_icon_name('emblem-default', 1) except: - self.proftp_status.set_text('Cannot connect') - self.ftp_img_status.set_from_icon_name('emblem-important', 1) + self.ftpd_status.set_text('Cannot connect') + self.ftpd_img_status.set_from_icon_name('emblem-important', 1) #restart ProFTPD button def on_button_p_restart_clicked(self, *args): + try: - if 'sudo' not in os.popen('sudo /opt/lampp/lampp status').readlines()[0]: + try: + if 'Cannot run program' not in os.popen('service vsftpd status').readlines()[0]: + os.system('service vsftpd restart') + status_command = os.popen('service vsftpd status').readlines() + if 'running' in str(status_command[2]): + self.ftpd_status.set_text('Active') + self.ftpd_img_status.set_from_icon_name('emblem-default', 1) + elif 'dead' in str(status_command[2]): + self.ftpd_status.set_text('Inactive') + self.ftpd_img_status.set_from_icon_name('emblem-unreadable', 1) + + except: + if 'sudo' not in os.popen('sudo /opt/lampp/lampp status').readlines()[0]: os.popen('sudo /opt/lampp/lampp reloadftp') os.popen('sudo /opt/lampp/lampp startftp') status_command = os.popen('sudo /opt/lampp/lampp status').readlines() if 'ProFTPD is deactivated' in str(status_command[3]) or 'ProFTPD is not running' in str(status_command[3]): - self.proftp_status.set_text('Inactive') + self.ftpd_status.set_text('Inactive') self.ftp_img_status.set_from_icon_name('emblem-unreadable', 1) elif 'ProFTPD is running' in str(status_command[3]): - self.proftp_status.set_text('Active') - self.ftp_img_status.set_from_icon_name('emblem-default', 1) + self.ftpd_status.set_text('Active') + self.ftpd_img_status.set_from_icon_name('emblem-default', 1) except: - self.proftp_status.set_text('Cannot connect') - self.ftp_img_status.set_from_icon_name('emblem-important', 1) + self.ftpd_status.set_text('Cannot connect') + self.ftpd_img_status.set_from_icon_name('emblem-important', 1) ########################################################################################################## @@ -432,103 +488,27 @@ def on_about_clicked(self, *args): #start all button def on_button_start_all_clicked(self, *args): - try: - self.on_button_a_start_clicked() - self.on_button_m_start_clicked() - self.on_button_p_start_clicked() - except: - - if 'sudo' not in os.popen('sudo /opt/lampp/lampp status').readlines()[0]: - os.system('sudo /opt/lampp/lampp start') - - status_command = os.popen('sudo /opt/lampp/lampp status').readlines() - - if 'ProFTPD is deactivated' in str(status_command[3]) or 'ProFTPD is not running' in str(status_command[3]): - self.proftp_status.set_text('Inactive') - self.ftp_img_status.set_from_icon_name('emblem-unreadable', 1) - elif 'ProFTPD is running' in str(status_command[3]): - self.proftp_status.set_text('Active') - self.ftp_img_status.set_from_icon_name('emblem-default', 1) - - if 'Apache is not running' in str(status_command[1]): - self.apache_status.set_text('Inactive') - self.apache_img_status.set_from_icon_name('emblem-unreadable', 1) - elif 'Apache is running' in str(status_command[1]): - self.apache_status.set_text('Active') - self.apache_img_status.set_from_icon_name('emblem-default', 1) - - if 'MySQL is not running' in str(status_command[2]): - self.mysql_status.set_text('Inactive') - self.mysql_img_status.set_from_icon_name('emblem-unreadable', 1) - elif 'MySQL is running' in str(status_command[2]): - self.mysql_status.set_text('Active') - self.mysql_img_status.set_from_icon_name('emblem-default', 1) + self.on_button_a_start_clicked() + self.on_button_m_start_clicked() + self.on_button_p_start_clicked() #stop all button def on_button_stop_all_clicked(self, *args): - try: - self.on_button_a_stop_clicked() - self.on_button_m_stop_clicked() - self.on_button_p_stop_clicked() - except IndexError: - if 'sudo' not in os.popen('sudo /opt/lampp/lampp status').readlines()[0]: - os.system('sudo /opt/lampp/lampp stop') - status_command = os.popen('sudo /opt/lampp/lampp status').readlines() - if 'ProFTPD is deactivated' in str(status_command[3]) or 'ProFTPD is not running' in str(status_command[3]): - self.proftp_status.set_text('Inactive') - self.ftp_img_status.set_from_icon_name('emblem-unreadable', 1) - elif 'ProFTPD is running' in str(status_command[3]): - self.proftp_status.set_text('Active') - self.ftp_img_status.set_from_icon_name('emblem-default', 1) - - if 'Apache is not running' in str(status_command[1]): - self.apache_status.set_text('Inactive') - self.apache_img_status.set_from_icon_name('emblem-unreadable', 1) - elif 'Apache is running' in str(status_command[1]): - self.apache_status.set_text('Active') - self.apache_img_status.set_from_icon_name('emblem-default', 1) + self.on_button_a_stop_clicked() + self.on_button_m_stop_clicked() + self.on_button_p_stop_clicked() - if 'MySQL is not running' in str(status_command[2]): - self.mysql_status.set_text('Inactive') - self.mysql_img_status.set_from_icon_name('emblem-unreadable', 1) - elif 'MySQL is running' in str(status_command[2]): - self.mysql_status.set_text('Active') - self.mysql_img_status.set_from_icon_name('emblem-default', 1) #restart all button def on_button_restart_all_clicked(self, *args): - try: - self.on_button_a_restart_clicked() - self.on_button_m_restart_clicked() - self.on_button_p_restart_clicked() - except IndexError: - os.system('sudo /opt/lampp/lampp reload; sudo /opt/lampp/lampp start') - if 'sudo' not in os.popen('sudo /opt/lampp/lampp status').readlines()[0]: - status_command = os.popen('sudo /opt/lampp/lampp status').readlines() - if 'ProFTPD is deactivated' in str(status_command[3]) or 'ProFTPD is not running' in str(status_command[3]): - self.proftp_status.set_text('Inactive') - self.ftp_img_status.set_from_icon_name('emblem-unreadable', 1) - elif 'ProFTPD is running' in str(status_command[3]): - self.proftp_status.set_text('Active') - self.ftp_img_status.set_from_icon_name('emblem-default', 1) - - if 'Apache is not running' in str(status_command[1]): - self.apache_status.set_text('Inactive') - self.apache_img_status.set_from_icon_name('emblem-unreadable', 1) - elif 'Apache is running' in str(status_command[1]): - self.apache_status.set_text('Active') - self.apache_img_status.set_from_icon_name('emblem-default', 1) + self.on_button_a_restart_clicked() + self.on_button_m_restart_clicked() + self.on_button_p_restart_clicked() - if 'MySQL is not running' in str(status_command[2]): - self.mysql_status.set_text('Inactive') - self.mysql_img_status.set_from_icon_name('emblem-unreadable', 1) - elif 'MySQL is running' in str(status_command[2]): - self.mysql_status.set_text('Active') - self.mysql_img_status.set_from_icon_name('emblem-default', 1) ########################################################### # install lampp button