Skip to content

Commit b105003

Browse files
author
retrohacker
committed
add support for raspbian
1 parent 378758f commit b105003

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

logic/raspbian.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var releaseRegex = /VERSION_ID="(.*)"/
2+
var codenameRegex = /VERSION="[0-9] \((.*)\)"/
3+
4+
module.exports = function raspbianCustomLogic (os, file, cb) {
5+
var release = file.match(releaseRegex)
6+
if (release && release.length === 2) os.release = release[1]
7+
var codename = file.match(codenameRegex)
8+
if (codename && codename.length === 2) os.codename = codename[1]
9+
cb(null, os)
10+
}

os.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"/etc/lsb-release" : ["Ubuntu Linux","Chakra","IYCC","Linux Mint","elementary OS","Arch Linux"],
77
"/etc/debian_version" : ["Debian"],
88
"/etc/debian_release" : ["Debian"],
9+
"/etc/os-release": ["Raspbian"],
910
"/etc/annvix-release" : ["Annvix"],
1011
"/etc/arch-release" : ["Arch Linux"],
1112
"/etc/arklinux-release" : ["Arklinux"],

tests/mockdata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
, { "desc": "RHEL 7.0", "platform": "linux", "file": { "/etc/redhat-release": "Red Hat Enterprise Linux Server release 7.0 (Maipo)\n" }, "expected": { "codename": "maipo", "dist": "Red Hat Linux", "os": "linux", "release": "7.0" } }
2020

2121
, { "desc": "SUSE Linux", "platform": "linux", "file": { "/etc/SuSE-release": "SUSE Linux Enterprise Server 11 (x86_64)\nVERSION = 11\nPATCHLEVEL = 4\n" }, "expected": { "dist": "SUSE Linux", "os": "linux", "release": "11" } }
22-
2322
, { "desc": "Alpine Linux", "platform": "linux", "file": { "/etc/alpine-release": "3.3\n" }, "expected": { "dist": "Alpine Linux", "os": "linux", "release": "3.3" } }
2423
, { "desc": "Amazon Linux", "platform": "linux", "file": { "/etc/system-release": "Amazon Linux AMI release 2016.03"}, "expected": {"dist": "Amazon Linux", "os": "linux", "release": "2016.03"}}
2524
, { "desc": "Arch Linux", "platform": "linux", "file": { "/etc/lsb-release": "LSB_VERSION=1.4\nDISTRIB_ID=Arch\nDISTRIB_RELEASE=rolling\nDISTRIB_DESCRIPTION=\"Arch Linux\""}, "expected": {"dist": "Arch Linux", "os": "linux", "release": "rolling"}}
2625
, { "desc": "Linux Mint", "platform": "linux", "file": { "/etc/lsb-release": "DISTRIB_ID=LinuxMint\nDISTRIB_RELEASE=18\nDISTRIB_CODENAME=sarah\nDISTRIB_DESCRIPTION=\"Linux Mint 18 Sarah\""}, "expected": {"dist": "Linux Mint", "os": "linux", "codename": "sarah", "release": "18"}}
26+
27+
, { "desc": "Raspbian 8", "platform": "linux", "file": { "/etc/os-release": "PRETTY_NAME=\"Raspbian GNU/Linux 8 (jessie)\"\nNAME=\"Raspbian GNU/Linux\"\nVERSION_ID=\"8\"\nVERSION=\"8 (jessie)\"\nID=raspbian\nHOME_URL=\"http://www.raspbian.org/\"\nSUPPORT_URL=\"http://www.raspbian.org/RaspbianForums\"\nBUG_REPORT_URL=\"http://www.raspbian.org/RaspbianBugs\"" }, "expected": { "codename": "jessie", "dist": "Raspbian", "os": "linux", "release": "8" } }
2728
]

0 commit comments

Comments
 (0)