-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpkgng.sh
More file actions
46 lines (38 loc) · 1017 Bytes
/
pkgng.sh
File metadata and controls
46 lines (38 loc) · 1017 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# PKGNG bootstrapper
# 20150312, Mohammad Al-Shami
# Use full pathes just in case
PKG=/usr/sbin/pkg
ENV=/usr/bin/env
UNAME=/usr/bin/uname
SED=/usr/bin/sed
MV=/bin/mv
RM=/bin/rm
MKDIR=/bin/mkdir
CAT=/bin/cat
# If for some reason you want to use a different package server
# Send it as a parameter to the script
if [ ! -z $1 ]; then
pkgServer=$1
else
pkgServer=192.168.1.150
fi
release=`$UNAME -r | $SED -r "s/([0-9]+).([0-9]+)-RELEASE.*/\1\2x64/"`
export PACKAGESITE=http://$pkgServer/$release-default
# Remove the default FreeBSD repo, only if it exists
if [ -f /etc/pkg/FreeBSD.conf ]; then
$MV /etc/pkg/FreeBSD.conf /etc/pkg/FreeBSD.conf.org
fi
# Bootstrap pkg
$ENV ASSUME_ALWAYS_YES=YES $PKG bootstrap
# Perform some cleanup
$RM -f /usr/local/etc/pkg.conf
# Set up our repo, which will then be overwritten by Salt
$MKDIR -p /usr/local/etc/pkg/repos/
$CAT > /usr/local/etc/pkg/repos/magneto.conf <<EOF
magneto : {
url : "pkg+$PACKAGESITE",
mirror_type : "srv",
enabled : true,
}
EOF