source: src-sh/pbi-manager10/install.sh @ 44335dc

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

Update pbi-manager10:

  • add PATH links to /usr/pbi/bin
  • add MAN links to /usr/pbi/man
  • add rc.d entries to /usr/pbi/rc.d
  • add MANPATH file to /usr/local/etc/man.d/pbi.conf

This will keep PBIs out of the /usr/local namespace, while still
keeping manpage / rc.d / path functionality intact

  • Property mode set to 100755
File size: 3.9 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`
20DIR=`realpath $DIR`
21cd ${DIR}
22
23# Install the app
24mkdir ${LB}/sbin >/dev/null 2>/dev/null
25cp pbi-manager ${LB}/sbin/pbi_create
26ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_add
27ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_addrepo
28ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_browser
29ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_autobuild
30ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_delete
31ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_deleterepo
32ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_icon
33ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_info
34ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_indextool
35ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_listrepo
36ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_makepatch
37ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_makeport
38ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_makerepo
39ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_metatool
40ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_patch
41ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_update
42ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi_update_hashdir
43ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbid
44ln -f ${LB}/sbin/pbi_create ${LB}/sbin/pbi-crashhandler
45
46# Set the new PREFIX / LOCALBASE
47if [ "$LB" != /usr/local ] ; then
48  sed -i '' "s|PROGBASE=/usr/local|PROGBASE=$LB|g" ${LB}/sbin/pbi_create
49fi
50
51# Install manpages
52mkdir -p ${LB}/man/man1 >/dev/null 2>/dev/null
53for i in `ls man1/`
54do
55  rm ${LB}/man/man1/${i}.gz >/dev/null 2>/dev/null
56  gzip -c man1/${i} > ${LB}/man/man1/${i}.gz
57done
58
59mkdir -p ${LB}/man/man5 >/dev/null 2>/dev/null
60for i in `ls man5/`
61do
62  rm ${LB}/man/man5/${i}.gz >/dev/null 2>/dev/null
63  gzip -c man5/${i} > ${LB}/man/man5/${i}.gz
64done
65
66
67mkdir -p ${LB}/man/man8 >/dev/null 2>/dev/null
68for i in `ls man8/`
69do
70  rm ${LB}/man/man8/${i}.gz >/dev/null 2>/dev/null
71  gzip -c man8/${i} > ${LB}/man/man8/${i}.gz
72done
73
74if [ -d "${LB}/share/pbi-manager" ] ; then rm -rf "${LB}/share/pbi-manager" ; fi
75
76# Copy over the examples
77mkdir -p ${LB}/share/pbi-manager/ >/dev/null 2>/dev/null
78cp -r ${DIR}/module-examples ${LB}/share/pbi-manager/
79
80# Copy the icon
81mkdir -p ${LB}/share/pbi-manager/icons >/dev/null 2>/dev/null
82cp ${DIR}/icons/default.png ${LB}/share/pbi-manager/icons
83cp ${DIR}/icons/patch.png ${LB}/share/pbi-manager/icons
84
85# If this is a new install, add the PC-BSD master repo
86#if [ ! -d "/var/db/pbi/keys" ] ; then
87#       pbi_addrepo ${DIR}/repo/pcbsd.rpo
88#fi
89
90# Copy the default PC-BSD repo file
91cp ${DIR}/repo/pcbsd.rpo ${LB}/share/pbi-manager/pcbsd.rpo
92
93# Tickle the info command to setup default dirs
94${LB}/sbin/pbi_info >/dev/null 2>/dev/null
95
96# Copy pbid / pbi.conf
97cp ${DIR}/rc.d/pbid ${LB}/etc/rc.d/pbid
98cp ${DIR}/etc/pbi.conf ${LB}/etc/pbi.conf
99
100# Create the wrapper binary
101cd ${DIR}/wrapper
102if [ `uname -m` = "amd64" ] ; then
103  # Build 32bit wrapper
104  echo "Building i386 wrapper..."
105  rm pbiwrapper >/dev/null 2>/dev/null
106  make clean
107  make DEFINES="-mtune=i386 -march=i386 -m32"
108  make install
109  chown root:wheel pbiwrapper
110  chmod 644 pbiwrapper
111  mv pbiwrapper ${LB}/share/pbi-manager/.pbiwrapper-i386
112else
113  touch ${LB}/share/pbi-manager/.pbiwrapper-i386
114fi
115
116# Build system arch wrapper
117echo "Building `uname -m` wrapper..."
118DEFINES=""
119export DEFINES
120rm pbiwrapper >/dev/null 2>/dev/null
121make clean
122make DEFINES=""
123make install DEFINES=""
124chown root:wheel pbiwrapper
125chmod 644 pbiwrapper
126mv pbiwrapper ${LB}/share/pbi-manager/.pbiwrapper-`uname -m`
127
128# Install the pbime wrapper
129cd ${DIR}/pbime && make install
130
131# Install the nullfs binary
132cd ${DIR}/mount_nullfs && make install
133
134# Install the MANPATH conf
135if [ ! -d "${LB}/etc/man.d" ] ; then
136   mkdir -p "${LB}/etc/man.d"
137fi
138cp ${DIR}/man.d/pbi.conf ${LB}/etc/man.d/pbi.conf
Note: See TracBrowser for help on using the repository browser.