Skip to content

Commit 54d3d2a

Browse files
committed
Merge pull request #17 from bochoven/patch-1
Update munkiinabox.sh from bochoven for testing.
2 parents 499acaa + 8070b17 commit 54d3d2a

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

munkiinabox.sh

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -399,19 +399,37 @@ sed -i.orig "s|/munki/|/${HOSTNAME}/|" munki-enroll/munki_enroll.sh
399399

400400
cd "${WEBROOT}"
401401
${GIT} clone https://github.com/munkireport/munkireport-php.git
402-
cp munkireport-php/config_default.php munkireport-php/config.php
403-
chmod +a "_www allow add_file,delete_child" munkireport-php/app/db
402+
MR_CONFIG="munkireport-php/config.php"
403+
MR_BASEURL="https://$HOSTNAME/munkireport-php/index.php?"
404+
MR_DB_DIR="/var/munkireport"
405+
406+
# Create database directory
407+
mkdir -p $MR_DB_DIR
408+
chmod +a "_www allow add_file,delete_child" $MR_DB_DIR
409+
410+
echo "<?php" > ${MR_CONFIG}
411+
echo >> ${MR_CONFIG}
412+
echo "\$conf['pdo_dsn'] = 'sqlite:$MR_DB_DIR/db.sqlite';" >> ${MR_CONFIG}
413+
404414
echo "short_open_tag = On" >> "${PHPROOT}/php.ini"
405-
echo "\$auth_config['root'] = '\$P\$BSQDsvw8vyCZxzlPaEiXNoP6CIlwzt/';" >> munkireport-php/config.php
415+
echo "\$auth_config['root'] = '\$P\$BSQDsvw8vyCZxzlPaEiXNoP6CIlwzt/';" >> ${MR_CONFIG}
406416

407417
# This creates a user "root" with password "root"
408418
# Now to download the pkgsinfo file into the right place and add it to the catalogs and site_default manifest:
409419

410-
echo "Downloading the MunkiReport Info"
420+
echo "Downloading available modules"
421+
422+
curl -k -L "$MR_BASEURL/install/dump_modules/config" >> ${MR_CONFIG}
423+
424+
echo "Creating the MunkiReport Client installer package"
425+
426+
bash -c "$(curl -k -L $MR_BASEURL/install)" bash -i ${REPOLOC}
427+
428+
echo "Importing the munkireport Client installer package"
411429

412-
curl -k -L "https://$HOSTNAME/munkireport-php/index.php?/install/plist" -o "${REPODIR}/pkgsinfo/MunkiReport.plist"
430+
$MUNKILOC/munkiimport -n "$REPOLOC/munkireport-"*.pkg
413431

414-
echo "Downloaded the MunkiReport Info, Now Rebuilding Catalogs"
432+
echo "Imported the MunkiReport Client installer package, Now Rebuilding Catalogs"
415433

416434
/usr/local/munki/makecatalogs
417435

@@ -429,9 +447,10 @@ rm "$REPOLOC/autopkg-latest1.pkg"
429447
rm "$REPOLOC/munkitools2.pkg"
430448
rm "$REPOLOC/munkiadmin.dmg"
431449
rm "$REPOLOC/AutoPkgr.dmg"
450+
rm "$REPOLOC/munkireport-"*.pkg
432451

433452
${LOGGER} "I put my toys away."
434453

435454
echo "Thank you for flying Munki in a Box Air. You now have a working repo, go forth and install your clients."
436455

437-
exit 0
456+
exit 0

0 commit comments

Comments
 (0)