Relative paths in configuration profiles

Apple wants you to use configuration profiles for setting up your client preferences. And because I don’t want to fight the fruity company I decided that this year I was moving (most) of my first boot scripts and custom plists to config profiles.

One issue I faced and that could not get my head around is that, if you want to set up the users’ Dock with no merging (that is getting rid of Apple default apps) you loose the ability to add user folders. Including the always-useful Downloads folder.

I tried all the combinations with no luck and even though very seriously on going back to fighting the fruit company and keep using non-standard ways of setting the Dock.

Then I found this key

bash-3.2$ defaults read /System/Library/CoreServices/ persistent-others
        "tile-data" =         {
            arrangement = 2;
            "home directory relative" = "~/Downloads";
            showas = 1;
        "tile-type" = "directory-tile";

It was like “home directory relative… Whaaaat?!” (insert your favourite meme)

Correct. That “just works” and looks like it is the official fruity way that has been around since 10.5 and I had absolutely no clue.

Here is the bottom of my Dock.mobileconfig which works perfectly fine

              <key>home directory relative</key>

As one last addition to the post I want to add that if you try to edit a configuration profile you downloaded from your MDM by hand, to do things like this or any similar thing, you will see that the .mobileconfig is 4 lines and is not indented. I did open a bug for this but it was closed because it doesn’t affect functionality. Yeah! it only makes admins their tasks a bit more difficult :S

In case you want to automatically indent the file without breaking the plist just paste the content on this free XML parser from the App Store. It has been a time saver for me

Posted in IT and stuff Tagged with: , ,

Backup and restore Munkireport-php

Here’s a little tip of how I backup my mr-php MySQL database

mysqldump -u root -p munkireport | bzip2 -c > ${HOME}/dbdump_`date +%d-%m-%Y`.bz2

This command will prompt for the MySQL root password and generate a compressed backup of the database in your home folder.

For restoring it, this command will uncompress it and restored to the munkireport database.

bzcat ~/dbdump_21-07-2014.bz2 | mysql -u root munkireport

Note that these are just examples. You can use any user account that has access to the database and your database might not be called munkireport

Posted in IT and stuff Tagged with: , , ,

Script: loop sites and get http response

Brief post from the iPad to post a script to check the response of a website and display the http codes in colored output.

#gets the exit codes for 2x website builds
#.2026 seems to be the first valid build for 11.1 version


while [[ ${BUILDLOWER} < ${BUILDHIGHER} ]]; do
	RESULT=`curl -s -o /dev/null -w "%{http_code}"${BUILDLOWER}/`
	if [[ ${RESULT} == "200" ]]; then
		#200 --> OK
		echo "${BUILDLOWER}/ --> `echo $'\e[36m' '200' $'\e[0m'`"
		curl -s${BUILDLOWER}/ --list-only | grep pkg
	elif [[ ${RESULT} == "300" ]]; then
 		#300 --> Multiple Choices
 		echo "${BUILDLOWER}/ --> `echo $'\e[31m' '300' $'\e[0m'`"
 	elif [[ ${RESULT} == "301" ]]; then
 		#301 --> Moved Permanently
 		echo "${BUILDLOWER}/ --> `echo $'\e[32m' '301' $'\e[0m'`"

echo "Finish!"
exit 0
Posted in IT and stuff