Skip to content

Commit

Permalink
Fixed Fedora compatibility
Browse files Browse the repository at this point in the history
Fedora was listed as based on Red Hat which isn't really
true as fedora can be thought of as Red Hat's testing grounds.
Now, Fedora is listed as it's own entity using dnf instead of
yum. This was tested with Korora 25 based on Fedora 25
  • Loading branch information
CodyKank committed May 4, 2017
1 parent a10238a commit 0d48ac2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ follows:
| Elementary | Debian |
| Antergos | Arch |
| Manjaro | Arch |
| Fedora | RHEL |
| CentOs | RHEL |
| Scientific | RHEL |
| Korora | Fedora |

#### Supported Independent/Parent distributions
| Distro | Supported |
Expand All @@ -30,6 +30,7 @@ follows:
| Arch | Yes |
| Debian | Yes |
| Solus | Yes |
| Fedora | Yes |

#### Options
* The script can be run with the optional argument of -s to skip the update
Expand Down
17 changes: 10 additions & 7 deletions python_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
// Python 3 Linux System Update Script \\
// Cody Kankel \\
|| Started Jul 11, 2016 ||
|| Last update: Mar 17th, 2017 ||
\\Currently only supports debian/ubuntu distros with apt-get, and Arch based distros with pacman.//
\\ Also supports the independent distro Solus //
|| Last update: May 3rd, 2017 ||
\\ Currently supports Arch, Red-Hat, Fedora, and Solus and those based on them. //
\\ //
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\///////////////////////////////////////////////"""

import subprocess, sys
Expand Down Expand Up @@ -78,6 +78,9 @@ def update(user_name):
update.wait()
save_update(user_name)
print("Update complete. . .")
elif system == 'fedora':
subprocess.check_call(['su','-c', 'dnf upgrade'])
save_update(user_name)
else:
print("\nSystem is not recognized currently. If you feel as if this is an error,\n"\
+ "please report it on Github.\n")
Expand All @@ -95,16 +98,16 @@ def get_system_type():
system_id = system_id[system_id.find('=') + 1:]

# switch statement wanna-be
distro_choices = {'fedora': 'rhel', 'centos': 'rhel', 'scientific': 'rhel', 'rhel': 'rhel', \
distro_choices = {'fedora': 'fedora', 'centos': 'rhel', 'scientific': 'rhel', 'rhel': 'rhel', \
'debian': 'debian', 'ubuntu': 'debian', 'xubuntu': 'debian', 'galliumos': 'debian', \
'elementary': 'debian', 'arch': 'arch', 'antergos': 'arch', 'manjaro': 'arch', \
'solus': 'solus'}
default = 'Unknown'
system = distro_choices.get(system_id, default)
print(system)
if system == default:
system_id = subprocess.getoutput("cat /etc/os-release | grep'ID_LIKE=").split('\n')[0]
system_id = system_id.replace('"', '')

system_id = subprocess.getoutput("cat /etc/os-release | grep 'ID_LIKE='").split('=')[1]
system = system_id.replace('"', '')
return system
#^----------------------------------------------------------------------------- find_system_type()

Expand Down

0 comments on commit 0d48ac2

Please sign in to comment.