about summary refs log tree commit diff stats
path: root/core/scripts/ports.sh
blob: a9cd9018a774c2e2dd47409602ac0131d1508231 (plain) (blame)
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
#!/bin/bash

ADMIN_USER=c9admin
CHROOT=/mnt

DIR=$(dirname "$PWD");
DIR_CONF=$DIR"/conf"

printf "CHROOT="$CHROOT"\n";
printf "DIR_CONF="$DIR_CONF"\n";

echo "1.3.1. Build as unprivileged user;"

chroot $CHROOT /bin/bash -c "useradd -U -m -d /usr/ports -s /bin/false pkgmk"
chroot $CHROOT /bin/bash -c "usermod -a -G pkgmk $ADMIN_USER"
chroot $CHROOT /bin/bash -c "chown -R root:pkgmk /usr/ports"
chroot $CHROOT /bin/bash -c "chmod -R 774 /usr/ports"
chroot $CHROOT /bin/bash -c "chmod 775 /usr/ports"

echo "1.3.2. Ports Layout;"

chroot --userspec=pkgmk:pkgmk $CHROOT /bin/bash -c "mkdir /usr/ports/packages"
chroot --userspec=pkgmk:pkgmk $CHROOT /bin/bash -c "mkdir /usr/ports/work"
chroot --userspec=pkgmk:pkgmk $CHROOT /bin/bash -c "mkdir /usr/ports/pkgbuild"
chroot --userspec=pkgmk:pkgmk $CHROOT /bin/bash -c "mkdir /usr/ports/distfiles"

chroot $CHROOT /bin/bash -c "id pkgmk"
read PAUSE
vim $CHROOT/etc/fstab

echo "1.3.3 Configure pkgmk;"
cp $DIR_CONF/pkgmk.conf $CHROOT/etc/
#vim $CHROOT/etc/pkgmk.conf

echo "1.3.4 Configure prt-get;"
mv $CHROOT/etc/ports/contrib.rsync.inactive $CHROOT/etc/ports/contrib.rsync
cp $DIR_CONF/prt-get.conf $CHROOT/etc/
#vim $CHROOT/etc/prt-get.conf