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

releng/10.0releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1
Last change on this file since a7429d5 was a7429d5, checked in by Kris Moore <kris@…>, 11 months ago

Add a cool new system callback function to PBIs on 10.x and beyond

This allows PBIs, which run in a container, to use the pbisyscmd, openwith
or xdg-open, and "talk" to applications on the outside of the container.

The use-case for this would be a application like Thunderbird, which may
want to use the "xdg-open" command to open a PDF file with something else
on the system.

It could be used by other apps, such as terminal emulators to run a shell on the system,
even though the GUI is run in the container

  • Property mode set to 100755
File size: 5.2 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
114  if [ "${LB}" = "/usr/local" ] ; then
115     install -o root -g wheel -m 755 ${LB}/share/pbi-manager/.pbiwrapper-i386 /usr/pbi/.pbi-wrapper-i386
116  fi
117else
118  touch ${LB}/share/pbi-manager/.pbiwrapper-amd64
119fi
120
121# Build system arch wrapper
122echo "Building `uname -m` wrapper..."
123DEFINES=""
124export DEFINES
125rm pbiwrapper >/dev/null 2>/dev/null
126make clean
127make DEFINES=""
128make install DEFINES=""
129chown root:wheel pbiwrapper
130chmod 644 pbiwrapper
131mv pbiwrapper ${LB}/share/pbi-manager/.pbiwrapper-`uname -m`
132if [ "${LB}" = "/usr/local" ] ; then
133   install -o root -g wheel -m 755 ${LB}/share/pbi-manager/.pbiwrapper-`uname -m` /usr/pbi/.pbi-wrapper-`uname -m`
134fi
135
136# Install the pbime wrapper
137cd ${DIR}/pbime && make
138install -o root -g wheel -m 4751 pbime ${LB}/share/pbi-manager/.pbime
139install -o root -g wheel -m 755 pbimount ${LB}/share/pbi-manager/.pbimount
140install -o root -g wheel -m 755 ldconfig ${LB}/share/pbi-manager/.ldconfig
141install -o root -g wheel -m 755 pbisyslisten ${LB}/share/pbi-manager/.pbisyslisten
142install -o root -g wheel -m 755 pbisyscmd ${LB}/share/pbi-manager/.pbisyscmd
143if [ "${LB}" = "/usr/local" ] ; then
144  install -o root -g wheel -m 4751 pbime /usr/pbi/.pbime
145  install -o root -g wheel -m 755 pbimount /usr/pbi/.pbimount
146  install -o root -g wheel -m 755 ldconfig /usr/pbi/.ldconfig
147  install -o root -g wheel -m 755 pbisyslisten /usr/pbi/.pbisyslisten
148  install -o root -g wheel -m 755 pbisyscmd /usr/pbi/.pbisyscmd
149fi
150
151# Install the nullfs binary
152cd ${DIR}/mount_nullfs && make
153install -o root -g wheel -m 755 mount_nullfs ${LB}/share/pbi-manager/.mount_nullfs
154if [ "${LB}" = "/usr/local" ] ; then
155  install -o root -g wheel -m 755 mount_nullfs /usr/pbi/.mount_nullfs
156fi
157
158# Install the MANPATH conf
159if [ ! -d "${LB}/etc/man.d" ] ; then
160   mkdir -p "${LB}/etc/man.d"
161fi
162cp ${DIR}/man.d/pbi.conf ${LB}/etc/man.d/pbi.conf
Note: See TracBrowser for help on using the repository browser.