aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkitsunyan2018-05-01 13:37:53 +0000
committerkitsunyan2018-05-01 13:37:53 +0000
commit0fcbca4cd1b50ee7664d7ae8010f5d8f66f5f0dc (patch)
tree546710ce79305a8fe061e33e66d75d70c0c70862
parent5f7f4f2d713025f05cbc240323b6fe47bb6dbe24 (diff)
Fix os-release location
-rw-r--r--src/package.nim10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/package.nim b/src/package.nim
index 50ea369..3884a34 100644
--- a/src/package.nim
+++ b/src/package.nim
@@ -89,21 +89,21 @@ static:
raise newException(SystemError,
"only single matching repo available: " & os & ":" & repo)
-proc readOsId: string =
+proc readOsId: Option[string] =
var file: File
- if file.open("/usr/bin/os-release"):
+ if file.open("/usr/lib/os-release"):
try:
while true:
let rawLine = readLine(file)
if rawLine[0 .. 2] == "ID=":
- return rawLine[3 .. ^1]
+ return some(rawLine[3 .. ^1])
except EOFError:
discard
except IOError:
discard
finally:
file.close()
- return "arch"
+ return none(string)
let osId = readOsId()
@@ -115,7 +115,7 @@ proc lookupGitRepo*(repo: string, base: string, arch: string): Option[GitRepo] =
.replace("${ARCH}", arch)
packageRepos
- .filter(pr => osId in pr.os and repo in pr.repo)
+ .filter(pr => osId.isSome and osid.unsafeGet in pr.os and repo in pr.repo)
.map(pr => (pr.git.url.replaceAll, pr.git.branch.replaceAll, pr.git.path.replaceAll))
.optFirst