source: src-sh/pbi-manager10/install.sh @ 39079340

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

For PBIs on 10, add a "pbi <cmd>" and "app <cmd>" alias

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