Skip to content

Commit

Permalink
Fixed #2.
Browse files Browse the repository at this point in the history
Issue #2 was caused by the fact that some /etc/os-release 's place
quotation marks for their ID's (i.e. ID="antergos") while others do not
(i.e. ID=ubuntu). Changed the way the script finds the ID in regards to
the quotation marks.
  • Loading branch information
CodyKank committed Sep 13, 2016
1 parent ba0ff19 commit 326f5c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ def get_system_type():
and others as Arch, and Xubuntu, Ubuntu, and others asd Debian, and Scientific, CentOs, Fedora
and others as Red Hat. Method returns the base system as a string."""

system_id = subprocess.getoutput("cat /etc/os-release | grep 'ID'")
system_id = system_id[system_id.find('"') + 1:]
system_id = system_id[:system_id.find('"')].split()[0] #taking the first result
system_id = subprocess.getoutput("cat /etc/os-release | grep 'ID'").split()[0]
system_id.replace('"', '') # Some systems produce (")'s others do not!
system_id = system_id[system_id.find('=') + 1:]

# switch statement wanna-be
distro_choices = {'fedora': 'rhel', 'centos': 'rhel', 'scientific': 'rhel', 'rhel': 'rhel', \
Expand Down

0 comments on commit 326f5c5

Please sign in to comment.