Skip to content

Commit

Permalink
Fix #13
Browse files Browse the repository at this point in the history
  • Loading branch information
guoyunhe committed Jun 11, 2019
1 parent cbb28be commit 49cee21
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.5.2]

### Fixed

- Trim "NAME" and "VERSION" string [#13](https://github.com/openSUSE-zh/opi/issues/13)

## [0.5.1]

### Fixed
Expand Down Expand Up @@ -78,7 +84,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Choose package and install
- Keep or remove repository after installation

[Unreleased]: https://github.com/openSUSE-zh/opi/compare/v0.5.1...HEAD
[Unreleased]: https://github.com/openSUSE-zh/opi/compare/v0.5.2...HEAD
[0.5.2]: https://github.com/openSUSE-zh/opi/compare/v0.5.1...v0.5.2
[0.5.1]: https://github.com/openSUSE-zh/opi/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/openSUSE-zh/opi/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/openSUSE-zh/opi/compare/v0.3.2...v0.4.0
Expand Down
10 changes: 8 additions & 2 deletions opi
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,20 @@ Get system information
=cut

sub trim {
my $s = shift;
$s =~ s/^\s+|\s+$//g;
return $s
}

sub get_distribution {
my $prefix = shift;
my $config = Config::Tiny->read('/etc/os-release');
my $name = $config->{_}->{NAME};
my $version = $config->{_}->{VERSION};
$name = substr $name, 1, -1; # Remove quotes
$name = trim(substr($name, 1, -1)); # Remove quotes and trailing spaces
if ($version) {
$version = substr $version, 1, -1; # Remove quotes
$version = trim(substr($version, 1, -1)); # Remove quotes
}
if ($name eq 'openSUSE Tumbleweed') {
$name = 'openSUSE:Factory';
Expand Down

0 comments on commit 49cee21

Please sign in to comment.