.bashrc.d/01detect_system: Use os-release to detect Arch
authorW. Trevor King <wking@tremily.us>
Mon, 30 Apr 2018 21:15:00 +0000 (21:15 +0000)
committerW. Trevor King <wking@tremily.us>
Mon, 30 Apr 2018 21:15:00 +0000 (21:15 +0000)
Example content:

  NAME="Arch Linux ARM"
  ID=archarm
  ID_LIKE=arch
  PRETTY_NAME="Arch Linux ARM"
  ANSI_COLOR="0;36"
  HOME_URL="http://archlinuxarm.org/"
  SUPPORT_URL="https://archlinuxarm.org/forum"
  BUG_REPORT_URL="https://github.com/archlinuxarm/PKGBUILDs/issues"

I should probably update the others to use os-release too, but I'm
putting that off for now.

src/.bashrc.d/01detect_system

index 7030a1b6316e9ee629ba52a17ea4e3bee9c8ea93..03d8f1745871f541a38facd23686807c97559903 100644 (file)
@@ -9,6 +9,8 @@ if [ -z "${OS}" ]; then
                export OS='Gentoo'
        elif [ "${SHELL#*gentoo}" != "${SHELL}" ]; then  # assumes 'gentoo' in prefix
                export OS='Gentoo Prefix'
+       elif grep -i '^ID=.*arch' /etc/os-release > /dev/null 2>&1; then
+               export OS='Arch'
        elif grep -i debian /etc/issue > /dev/null 2>&1; then
                export OS='Debian'
        elif grep -i ubuntu /etc/issue > /dev/null 2>&1; then