Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
106 lines (83 sloc) 2.83 KB
#!/bin/sh
# postinst script for powerpc-wrs-vxworks-wrs-ip
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
PREFIX="/usr"
WIND_BASE="$PREFIX/powerpc-wrs-vxworks/wind_base"
TOOL_DIR="$PREFIX/powerpc-wrs-vxworks"
TMP_DIR=`mktemp -t -d wrs-headers-installer.XXXXXXXXXX` || exit 1
CONF_DIR="$PREFIX/share/wrs-headers"
LDSCRIPT_DIR="$TOOL_DIR/share/ldscripts"
FILES="$CONF_DIR/files"
MD5SUMS="$CONF_DIR/md5sums"
GCCDIST_URL="ftp://ftp.ni.com/pub/devzone/tut/updated_vxworks63gccdist.zip"
CUR_DIR=`pwd`
case "$1" in
configure)
#create directories
mkdir -p "$WIND_BASE"
mkdir -p "$TOOL_DIR"
mkdir -p "$WIND_BASE/target"
mkdir -p "$CONF_DIR"
mkdir -p "$LDSCRIPT_DIR"
#download gccdist and unzip
echo -n "Downloading gccdist... "
wget -q "$GCCDIST_URL" -O "$TMP_DIR/gccdist.zip"
echo "done."
#extract
echo -n "Extracting... "
unzip -qo "$TMP_DIR/gccdist.zip" -d "$TMP_DIR"
echo "done."
#perform install
echo -n "Installing... "
#copy scripts to proper location
SCRIPT_LOC="$TMP_DIR/gccdist/WindRiver/vxworks-6.3/host"
cp -R "$SCRIPT_LOC" "$WIND_BASE"
#get list of files just installed
find "$SCRIPT_LOC" -type f | sed "s|$SCRIPT_LOC|$WIND_BASE/host|" > "$FILES"
#copy headers to proper location
HEADER_LOC="$TMP_DIR/gccdist/WindRiver/vxworks-6.3/target/h"
cp -R "$HEADER_LOC/." "$TOOL_DIR/sys-include"
#get list of files just installed
find "$HEADER_LOC" -type f | sed "s|$HEADER_LOC|$TOOL_DIR/sys-include|" >> "$FILES"
#get md5sums
while read line
do
md5sum "$line" >> "$MD5SUMS"
done < "$FILES"
#make symlink to headers
ln -fs "$TOOL_DIR/sys-include" "$WIND_BASE/target/h"
ln -fs "$TOOL_DIR/sys-include/wrn/coreip" "$TOOL_DIR/include"
#take note of symlinks
echo "$WIND_BASE/target/h" >> $FILES
echo "$TOOL_DIR/include" >> $FILES
#Add in a link script
sed '/ENTRY(_start)/d' < "$WIND_BASE/target/h/tool/gnu/ldscripts/link.OUT" > "$LDSCRIPT_DIR/dkm.ld"
echo "$LDSCRIPT_DIR/dkm.ld" >> $FILES
#clean up
rm -rf "$TMP_DIR"
echo "done."
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0