source: src-sh/pbi-manager/install.sh @ c405e82

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1
Last change on this file since c405e82 was c405e82, checked in by Kris Moore <kris@…>, 13 months ago

Link pbi-manager10 into the build, fix ports pkg-plist if installing
to 10.x or higher

  • Property mode set to 100755
File size: 3.6 KB
Line 
1#!/bin/sh
2# pbi-manager installation script
3
4# Check if this is for the right version of FreeBSD
5verCheck="`grep '^#define __FreeBSD_version' /usr/include/sys/param.h | awk '{print $3}'`"
6if [ $verCheck -gt 1000000 ] ; then
7  # This version is for FreeBSD <= 10
8  exit 0
9fi
10
11DEFAULT="/usr/local"
12
13if [ -z "$1" ] ; then
14        LB="${DEFAULT}" 
15else
16        LB="${1}" 
17fi
18
19DIR=`dirname $0`
20cd ${DIR}
21
22# Install the app
23mkdir ${LB}/sbin >/dev/null 2>/dev/null
24cp pbi-manager ${LB}/sbin/pbi_create
25ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_add
26ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_addrepo
27ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_browser
28ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_autobuild
29ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_delete
30ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_deleterepo
31ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_icon
32ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_info
33ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_indextool
34ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_listrepo
35ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_makepatch
36ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_makeport
37ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_makerepo
38ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_metatool
39ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_patch
40ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_update
41ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_update_hashdir
42ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbid
43ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi-crashhandler
44
45# Set the new PREFIX / LOCALBASE
46if [ "$LB" != /usr/local ] ; then
47  sed -i '' "s|PROGBASE=/usr/local|PROGBASE=$LB|g" ${LB}/sbin/pbi_create
48fi
49
50# Install manpages
51mkdir -p ${LB}/man/man1 >/dev/null 2>/dev/null
52for i in `ls man1/`
53do
54  rm ${LB}/man/man1/${i}.gz >/dev/null 2>/dev/null
55  gzip -c man1/${i} > ${LB}/man/man1/${i}.gz
56done
57
58mkdir -p ${LB}/man/man5 >/dev/null 2>/dev/null
59for i in `ls man5/`
60do
61  rm ${LB}/man/man5/${i}.gz >/dev/null 2>/dev/null
62  gzip -c man5/${i} > ${LB}/man/man5/${i}.gz
63done
64
65
66mkdir -p ${LB}/man/man8 >/dev/null 2>/dev/null
67for i in `ls man8/`
68do
69  rm ${LB}/man/man8/${i}.gz >/dev/null 2>/dev/null
70  gzip -c man8/${i} > ${LB}/man/man8/${i}.gz
71done
72
73if [ -d "${LB}/share/pbi-manager" ] ; then rm -rf "${LB}/share/pbi-manager" ; fi
74
75# Copy over the examples
76mkdir -p ${LB}/share/pbi-manager/ >/dev/null 2>/dev/null
77cp -r ${DIR}/module-examples ${LB}/share/pbi-manager/
78
79# Copy the icon
80mkdir -p ${LB}/share/pbi-manager/icons >/dev/null 2>/dev/null
81cp ${DIR}/icons/default.png ${LB}/share/pbi-manager/icons
82cp ${DIR}/icons/patch.png ${LB}/share/pbi-manager/icons
83
84# If this is a new install, add the PC-BSD master repo
85#if [ ! -d "/var/db/pbi/keys" ] ; then
86#       pbi_addrepo ${DIR}/repo/pcbsd.rpo
87#fi
88
89# Copy the default PC-BSD repo file
90cp ${DIR}/repo/pcbsd.rpo ${LB}/share/pbi-manager/pcbsd.rpo
91
92# Tickle the info command to setup default dirs
93${LB}/sbin/pbi_info >/dev/null 2>/dev/null
94
95# Copy pbid / pbi.conf
96cp ${DIR}/rc.d/pbid ${LB}/etc/rc.d/pbid
97cp ${DIR}/etc/pbi.conf ${LB}/etc/pbi.conf
98
99# Create the wrapper binary
100cd ${DIR}/wrapper
101if [ `uname -m` = "amd64" ] ; then
102  # Build 32bit wrapper
103  echo "Building i386 wrapper..."
104  rm pbiwrapper >/dev/null 2>/dev/null
105  make clean
106  make DEFINES="-mtune=i386 -march=i386 -m32"
107  make install
108  chown root:wheel pbiwrapper
109  chmod 644 pbiwrapper
110  mv pbiwrapper ${LB}/share/pbi-manager/.pbiwrapper-i386
111else
112  touch ${LB}/share/pbi-manager/.pbiwrapper-amd64
113fi
114
115# Build system arch wrapper
116echo "Building `uname -m` wrapper..."
117DEFINES=""
118export DEFINES
119rm pbiwrapper >/dev/null 2>/dev/null
120make clean
121make DEFINES=""
122make install DEFINES=""
123chown root:wheel pbiwrapper
124chmod 644 pbiwrapper
125mv pbiwrapper ${LB}/share/pbi-manager/.pbiwrapper-`uname -m`
Note: See TracBrowser for help on using the repository browser.