Skip to content

Instantly share code, notes, and snippets.

@Cynede
Created September 10, 2018 19:24
Show Gist options
  • Save Cynede/0c9d916fa3f046058c8f14ca81270832 to your computer and use it in GitHub Desktop.
Save Cynede/0c9d916fa3f046058c8f14ca81270832 to your computer and use it in GitHub Desktop.
echo "Configuring libpci for your system..."
if [ -z "$HOST" ] ; then
sys=`uname -s`
rel=`uname -r`
realsys="$sys"
if [ "$sys" = "AIX" -a -x /usr/bin/oslevel -a -x /usr/sbin/lsattr ]
then
rel=`/usr/bin/oslevel`
proc=`/usr/sbin/lsdev -C -c processor -S available -F name | head -1`
cpu=`/usr/sbin/lsattr -F value -l $proc -a type | sed 's/_.*//'`
else
cpu=`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/;s/^BePC$/i386/;s/^BeMac$/powerpc/;s/^BeBox$/powerpc/'`
fi
if [ "$sys" = "GNU/kFreeBSD" -o "$sys" = "DragonFly" ]
then
sys=freebsd
fi
if [ "$sys" = "CYGWIN_NT-5.1" -o "$sys" = "CYGWIN_NT-6.0" ]
then
sys=cygwin
fi
HOST=${3:-$cpu-$sys}
fi
[ -n "$RELEASE" ] && rel="${RELEASE}"
# CAVEAT: tr on Solaris is a bit weird and the extra [] is otherwise harmless.
host=`echo $HOST | sed -e 's/^\([^-]*\)-\([^-]*\)-\([^-]*\)-\([^-]*\)$/\1-\3/' -e 's/^\([^-]*\)-\([^-]*\)-\([^-]*\)$/\1-\2/' -e 's/^\([^-]*\)-\([^-]*\)$/\1--\2/' | tr '[A-Z]' '[a-z]'`
cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
sys=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$sys"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment