mirror of
https://github.com/iiab/iiab.git
synced 2025-02-12 19:22:24 +00:00
54 lines
1.1 KiB
Bash
Executable file
54 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
OS=`grep ^ID= /etc/*elease|cut -d= -f2`
|
|
OS=${OS//\"/}
|
|
VERSION_ID=`grep VERSION_ID /etc/*elease | cut -d= -f2`
|
|
VERSION_ID=${VERSION_ID//\"/}
|
|
VERSION_ID=${VERSION_ID%%.*}
|
|
OS_VER=$OS-$VERSION_ID
|
|
|
|
case $OS_VER in
|
|
"fedora-18" | \
|
|
"fedora-22" | \
|
|
"debian-8" | \
|
|
"debian-9" | \
|
|
"ubuntu-16" | \
|
|
"centos-7" | \
|
|
"raspbian-8"| \
|
|
"raspbian-9")
|
|
;;
|
|
*) OS_VER="OS_not_supported"
|
|
;;
|
|
esac
|
|
# get current version
|
|
BRANCH=`git rev-parse --abbrev-ref HEAD`
|
|
COMMIT=`git rev-parse --verify HEAD`
|
|
|
|
if [ -d /usr/lib64/php ]
|
|
then
|
|
PHPLIB_DIR=/usr/lib64/php
|
|
else
|
|
if [ -d /usr/lib/php5 ]; then
|
|
PHPLIB_DIR=/usr/lib/php5
|
|
else
|
|
PHPLIB_DIR=/usr/lib/php
|
|
fi
|
|
fi
|
|
|
|
if [ -f /proc/device-tree/mfg-data/MN ]
|
|
then
|
|
XO_VERSION=`cat /proc/device-tree/mfg-data/MN`
|
|
else
|
|
XO_VERSION="none"
|
|
fi
|
|
|
|
ANSIBLE_VERSION=$(ansible --version|head -n 1|cut -f 2 -d " ")
|
|
cat <<EOF
|
|
{"phplib_dir" : "$PHPLIB_DIR",
|
|
"iiab_branch" : "$BRANCH",
|
|
"iiab_commit" : "$COMMIT",
|
|
"xo_model" : "$XO_VERSION",
|
|
"ansble_version" : "$ANSIBLE_VERSION",
|
|
"os" : "$OS",
|
|
"os_ver" : "$OS_VER"}
|
|
|
|
EOF
|