diff --git a/Installer/Info-admin.plist b/Installer/Info-admin.plist
new file mode 100644
index 00000000..8b34a21b
--- /dev/null
+++ b/Installer/Info-admin.plist
@@ -0,0 +1,40 @@
+
+
+
+
+ CFBundleIdentifier
+ com.github.rentzsch.clicktoflash.admin.pkg
+ CFBundleShortVersionString
+ 1
+ IFMajorVersion
+ 1
+ IFMinorVersion
+ 0
+ IFPkgFlagAllowBackRev
+
+ IFPkgFlagAuthorizationAction
+ RootAuthorization
+ IFPkgFlagDefaultLocation
+ /tmp
+ IFPkgFlagFollowLinks
+
+ IFPkgFlagInstallFat
+
+ IFPkgFlagInstalledSize
+ 1736
+ IFPkgFlagIsRequired
+
+ IFPkgFlagOverwritePermissions
+
+ IFPkgFlagRelocatable
+
+ IFPkgFlagRestartAction
+ None
+ IFPkgFlagRootVolumeOnly
+
+ IFPkgFlagUpdateInstalledLanguages
+
+ IFPkgFormatVersion
+ 0.1000000014901161
+
+
diff --git a/Installer/Info.plist b/Installer/Info-nonadmin.plist
similarity index 100%
rename from Installer/Info.plist
rename to Installer/Info-nonadmin.plist
diff --git a/Installer/build_installer_pkg.command b/Installer/build_installer_pkg.command
index 18eb160c..b5e7c4b5 100755
--- a/Installer/build_installer_pkg.command
+++ b/Installer/build_installer_pkg.command
@@ -20,7 +20,6 @@ fi
MY_INSTALLER_ROOT="$BUILT_PRODUCTS_DIR/ClickToFlash.dst"
BUILT_PLUGIN="$BUILT_PRODUCTS_DIR/ClickToFlash.webplugin"
-BUILT_PKG="$BUILT_PRODUCTS_DIR/ClickToFlash.pkg" # Sparkle currently can't handle -$VERSION in .pkg names.
VERSIONED_NAME="ClickToFlash-$PRODUCT_VERSION"
BUILT_ZIP="$BUILT_PRODUCTS_DIR/$VERSIONED_NAME.zip"
@@ -41,17 +40,59 @@ cp -R "$BUILT_PLUGIN" "$MY_INSTALLER_ROOT"
"$SYSTEM_DEVELOPER_UTILITIES_DIR/PackageMaker.app/Contents/MacOS/PackageMaker" \
--root "$BUILT_PRODUCTS_DIR/ClickToFlash.dst" \
- --info Info.plist \
- --resources resources \
+ --info Info-nonadmin.plist \
--scripts scripts \
--target 10.4 \
--version "$PRODUCT_VERSION" \
--verbose \
- --out "$BUILT_PKG"
+ --out "$BUILT_PRODUCTS_DIR/ClickToFlash-nonadmin.pkg"
+
+"$SYSTEM_DEVELOPER_UTILITIES_DIR/PackageMaker.app/Contents/MacOS/PackageMaker" \
+ --root "$BUILT_PRODUCTS_DIR/ClickToFlash.dst" \
+ --info Info-admin.plist \
+ --scripts scripts \
+ --target 10.4 \
+ --version "$PRODUCT_VERSION" \
+ --verbose \
+ --out "$BUILT_PRODUCTS_DIR/ClickToFlash-admin.pkg"
+
+
+
+# go into one of the packages and strip out the contents and symbolic link them to the other
+# package so that we keep the file size down, since the only difference is requiring admin auth
+
+cd "$BUILT_PRODUCTS_DIR/ClickToFlash-admin.pkg/Contents"
+rm Archive.bom
+rm Archive.pax.gz
+ln -s ../../ClickToFlash-nonadmin.pkg/Contents/Archive.bom ./
+ln -s ../../ClickToFlash-nonadmin.pkg/Contents/Archive.pax.gz ./
+cd $SCRIPT_WD
+
+
+
+# make the friggin' distribution ourselves since friggin' PackageMaker friggin' doesn't friggin' support this
+mkdir "$BUILT_PRODUCTS_DIR/ClickToFlash.mpkg"
+mkdir "$BUILT_PRODUCTS_DIR/ClickToFlash.mpkg/Contents"
+mkdir "$BUILT_PRODUCTS_DIR/ClickToFlash.mpkg/Contents/Packages/"
+mkdir "$BUILT_PRODUCTS_DIR/ClickToFlash.mpkg/Contents/Resources/"
+cp -R distribution-mpkg/resources/en.lproj "$BUILT_PRODUCTS_DIR/ClickToFlash.mpkg/Contents/Resources/en.lproj"
+cp -R distribution-mpkg/resources/admin_privs_needed.command "$BUILT_PRODUCTS_DIR/ClickToFlash.mpkg/Contents/Resources/admin_privs_needed.command"
+cp -R distribution-mpkg/resources/no_admin_privs_needed.command "$BUILT_PRODUCTS_DIR/ClickToFlash.mpkg/Contents/Resources/no_admin_privs_needed.command"
+cp distribution-mpkg/distribution.dist "$BUILT_PRODUCTS_DIR/ClickToFlash.mpkg/Contents/distribution.dist"
+
+cp -R "$BUILT_PRODUCTS_DIR/ClickToFlash-nonadmin.pkg" "$BUILT_PRODUCTS_DIR/ClickToFlash.mpkg/Contents/Packages/ClickToFlash-nonadmin.pkg"
+cp -R "$BUILT_PRODUCTS_DIR/ClickToFlash-admin.pkg" "$BUILT_PRODUCTS_DIR/ClickToFlash.mpkg/Contents/Packages/ClickToFlash-admin.pkg"
+
+
+# clean up the non-mpkg pkgs
+
+rm -rf "$BUILT_PRODUCTS_DIR/ClickToFlash-admin.pkg"
+rm -rf "$BUILT_PRODUCTS_DIR/ClickToFlash-nonadmin.pkg"
+
# Stuff it into a .zip.
cd "$BUILT_PRODUCTS_DIR"
-zip -r "$VERSIONED_NAME.zip" "ClickToFlash.pkg"
+zip -r "$VERSIONED_NAME.zip" "ClickToFlash.mpkg"
cd $SCRIPT_WD
rm -rf "$MY_INSTALLER_ROOT"
diff --git a/Installer/distribution-mpkg/distribution.dist b/Installer/distribution-mpkg/distribution.dist
new file mode 100644
index 00000000..42d19c4c
--- /dev/null
+++ b/Installer/distribution-mpkg/distribution.dist
@@ -0,0 +1,84 @@
+
+
+ ClickToFlash
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ file:./Contents/Packages/clicktoflash-admin.pkg
+ file:./Contents/Packages/clicktoflash-nonadmin.pkg
+
\ No newline at end of file
diff --git a/Installer/distribution-mpkg/resources/admin_privs_needed.command b/Installer/distribution-mpkg/resources/admin_privs_needed.command
new file mode 100755
index 00000000..e4f9210a
--- /dev/null
+++ b/Installer/distribution-mpkg/resources/admin_privs_needed.command
@@ -0,0 +1,23 @@
+#!/bin/bash
+cd "`dirname \"$0\"`"
+SCRIPT_WD=`pwd`
+DIR=/Library/Receipts/clicktoflash-nonadmin.pkg/
+GROUPS=`id -Gn $USER`
+
+if [ -d $DIR ]; then
+ echo "There is a receipt, no admin privs required for installer pkg."
+ exit 0
+fi
+
+if [ "$GROUPS" == "20" ]; then
+ echo "User has admin privs, no admin privs required for installer pkg."
+ exit 0
+else
+ if [[ "$GROUPS" =~ " 20 " ]]; then
+ echo "User has admin privs, no admin privs required for installer pkg."
+ exit 0
+ fi
+fi
+
+echo "No receipt, no admin privs, installer must ask for admin password."
+exit 1
\ No newline at end of file
diff --git a/Installer/resources/en.lproj/ReadMe.rtf b/Installer/distribution-mpkg/resources/en.lproj/ReadMe.rtf
similarity index 100%
rename from Installer/resources/en.lproj/ReadMe.rtf
rename to Installer/distribution-mpkg/resources/en.lproj/ReadMe.rtf
diff --git a/Installer/resources/en.lproj/background.tiff b/Installer/distribution-mpkg/resources/en.lproj/background.tiff
similarity index 100%
rename from Installer/resources/en.lproj/background.tiff
rename to Installer/distribution-mpkg/resources/en.lproj/background.tiff
diff --git a/Installer/distribution-mpkg/resources/no_admin_privs_needed.command b/Installer/distribution-mpkg/resources/no_admin_privs_needed.command
new file mode 100755
index 00000000..164ad647
--- /dev/null
+++ b/Installer/distribution-mpkg/resources/no_admin_privs_needed.command
@@ -0,0 +1,23 @@
+#!/bin/bash
+cd "`dirname \"$0\"`"
+SCRIPT_WD=`pwd`
+DIR=/Library/Receipts/clicktoflash-nonadmin.pkg/
+GROUPS=`id -Gn $USER`
+
+if [ -d $DIR ]; then
+ echo "There is a receipt, no admin privs required for installer pkg."
+ exit 1
+fi
+
+if [ "$GROUPS" == "20" ]; then
+ echo "User has admin privs, no admin privs required for installer pkg."
+ exit 1
+else
+ if [[ "$GROUPS" =~ " 20 " ]]; then
+ echo "User has admin privs, no admin privs required for installer pkg."
+ exit 1
+ fi
+fi
+
+echo "No receipt, no admin privs, installer must ask for admin password."
+exit 0
\ No newline at end of file
diff --git a/Installer/scripts/postflight b/Installer/scripts/postflight
index 4c106538..03aa38e5 100755
--- a/Installer/scripts/postflight
+++ b/Installer/scripts/postflight
@@ -3,6 +3,7 @@
rm -rf "$HOME/Library/Internet Plug-Ins/ClickToFlash.plugin"
rm -rf "$HOME/Library/Internet Plug-Ins/ClickToFlash.webplugin"
mv /tmp/ClickToFlash.webplugin "$HOME/Library/Internet Plug-Ins/"
+chown -R $USER "$HOME/Library/Internet Plug-Ins/ClickToFlash.webplugin"
pkgutil --forget com.github.rentzsch.clicktoflash.pkg
exit 0
\ No newline at end of file