source: src-sh/pbi-manager10/install.sh @ 651bd28

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

Add a new pbi-manager10 copy, this will be used for FreeBSD > 10

  • Property mode set to 100755
File size: 3.7 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 -lt 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  cp man1/${i} ${LB}/man/man1/${i}
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  cp man5/${i} ${LB}/man/man5/${i}
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  cp man8/${i} ${LB}/man/man8/${i}
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
85if [ ! -d "/var/db/pbi/keys" ] ; then
86        pbi_addrepo ${DIR}/repo/pcbsd.rpo
87fi
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
99if [ ! -d "/usr/pbi" ] ; then mkdir /usr/pbi ; fi
100
101# Create the wrapper binary
102cd ${DIR}/wrapper
103if [ `uname -m` = "amd64" ] ; then
104  # Build 32bit wrapper
105  echo "Building i386 wrapper..."
106  rm .pbiwrapper >/dev/null 2>/dev/null
107  make clean
108  make DEFINES="-mtune=i386 -march=i386 -m32"
109  make install
110  chown root:wheel /usr/pbi/.pbiwrapper
111  chmod 644 /usr/pbi/.pbiwrapper
112  mv /usr/pbi/.pbiwrapper ${LB}/share/pbi-manager/.pbiwrapper-i386
113else
114  touch ${LB}/share/pbi-manager/.pbiwrapper-i386
115fi
116
117# Build system arch wrapper
118echo "Building `uname -m` wrapper..."
119DEFINES=""
120export DEFINES
121rm .pbiwrapper >/dev/null 2>/dev/null
122make clean
123make DEFINES=""
124make install DEFINES=""
125chown root:wheel /usr/pbi/.pbiwrapper
126chmod 644 /usr/pbi/.pbiwrapper
127mv /usr/pbi/.pbiwrapper ${LB}/share/pbi-manager/.pbiwrapper-`uname -m`
Note: See TracBrowser for help on using the repository browser.