From 86174e51ffe4b451847a2ec5006bdef1020c82ea Mon Sep 17 00:00:00 2001 From: americast Date: Mon, 27 Feb 2017 02:37:52 +0530 Subject: [PATCH 1/3] Fix #261 for Arch Linux --- deps/build.jl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 deps/build.jl diff --git a/deps/build.jl b/deps/build.jl new file mode 100644 index 0000000..a7c1786 --- /dev/null +++ b/deps/build.jl @@ -0,0 +1,16 @@ +s="" +try + s = s * chomp(readstring(pipeline(`cat /etc/issue`, stderr=DevNull))) +end +try + s = s* chomp(readstring(pipeline(`cat /proc/version`, stderr=DevNull))) +end +try + if(contains(lowercase(s), "arch")) + try + run(pipeline(`sudo pacman -S unzip`, stdout=DevNull, stderr=DevNull)) + catch + println("Unable to install zip. Please install it manually.") + end + end +end From 3b1c5e0632e07dd550dae9ba1903a84c199439cb Mon Sep 17 00:00:00 2001 From: americast Date: Mon, 27 Feb 2017 05:38:13 +0530 Subject: [PATCH 2/3] Support for multiple distros --- deps/build.jl | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/deps/build.jl b/deps/build.jl index a7c1786..bb0a949 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -1,16 +1,26 @@ -s="" +commands = ["apt-get", "pacman", "yum", "zypper"] try - s = s * chomp(readstring(pipeline(`cat /etc/issue`, stderr=DevNull))) -end -try - s = s* chomp(readstring(pipeline(`cat /proc/version`, stderr=DevNull))) -end -try - if(contains(lowercase(s), "arch")) + run(pipeline(`which unzip`, stdout=DevNull, stderr=DevNull)) +catch + for i in commands + path=["",""] try - run(pipeline(`sudo pacman -S unzip`, stdout=DevNull, stderr=DevNull)) + path=split(readstring(pipeline(`which $(i)`, stderr=DevNull)),'/') catch - println("Unable to install zip. Please install it manually.") + continue + end + if (path[2]=="usr" && path[3]=="bin") + println("Installing unzip...") + try + if (i=="pacman") + run(pipeline(`sudo $(i) -S unzip`, stderr=DevNull)) + else + run(pipeline(`sudo $(i) install unzip`, stderr=DevNull)) + end + catch + println("Unable to install unzip. Please install it manually.") + end + break end end end From 3682bc31961b7cfc70448ba5a66b27f69e1fe796 Mon Sep 17 00:00:00 2001 From: americast Date: Mon, 27 Feb 2017 08:25:28 +0530 Subject: [PATCH 3/3] Remove which --- deps/build.jl | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/deps/build.jl b/deps/build.jl index bb0a949..0f30d9a 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -1,15 +1,11 @@ commands = ["apt-get", "pacman", "yum", "zypper"] +items="" try - run(pipeline(`which unzip`, stdout=DevNull, stderr=DevNull)) -catch + items = readstring((pipeline(`ls /usr/bin`, stderr = DevNull))); +end +if ((contains(items,"\nunzip\n") == false) && (items != "")) for i in commands - path=["",""] - try - path=split(readstring(pipeline(`which $(i)`, stderr=DevNull)),'/') - catch - continue - end - if (path[2]=="usr" && path[3]=="bin") + if (contains(items, "\n$(i)\n")) println("Installing unzip...") try if (i=="pacman") @@ -20,7 +16,6 @@ catch catch println("Unable to install unzip. Please install it manually.") end - break end end end