Skip to content

Commit

Permalink
New icon for user pdf spool folder
Browse files Browse the repository at this point in the history
Simplified buildscript for easier buildscript maintenance
Copyright added to pdfwriter.m
  • Loading branch information
rodyager committed Jun 3, 2016
1 parent 71dd5d6 commit 8cfa70b
Show file tree
Hide file tree
Showing 23 changed files with 45 additions and 39 deletions.
Binary file added sources/PDFfolder.iconset/icon_128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sources/PDFfolder.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sources/PDFfolder.iconset/icon_16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sources/PDFfolder.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sources/PDFfolder.iconset/icon_256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sources/PDFfolder.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sources/PDFfolder.iconset/icon_32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sources/PDFfolder.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sources/PDFfolder.iconset/icon_512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sources/PDFfolder.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sources/PDFwriter.iconset/icon_128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sources/PDFwriter.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sources/PDFwriter.iconset/icon_16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sources/PDFwriter.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sources/PDFwriter.iconset/icon_256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sources/PDFwriter.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sources/PDFwriter.iconset/icon_32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sources/PDFwriter.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sources/PDFwriter.iconset/icon_512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sources/PDFwriter.iconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed sources/PDFwriterFolder.icns
Binary file not shown.
73 changes: 35 additions & 38 deletions sources/buildscript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
# Created by Rodney I. Yager on 27.05.16
# Copyright 2016 Rodney I. Yager. All rights reserved

signstring=""

PDFWRITERDIR="pkgroot/Library/Printers/RWTS/PDFwriter"
PPDDIR="pkgroot/Library/Printers/PPDs/Contents/Resources"
PPDFILE="RWTS PDFwriter"

while getopts s: opt; do
case ${opt} in
s)
signstring=${OPTARG}
SIGNSTRING=${OPTARG}
;;
*)
echo "usage: buildscript [-s \"<your signing identity>\"]"
Expand All @@ -22,64 +25,58 @@ done

cd "$(dirname "$0")"
echo "#### making directory structure"
mkdir temp temp/pkgroot
cd temp
mkdir -m 775 pkgroot/Library pkgroot/Library/Printers pkgroot/Library/Printers/RWTS
mkdir -m 755 pkgroot/Library/Printers/RWTS/PDFwriter pkgroot/Library/Printers/PPDs pkgroot/Library/Printers/PPDs/Contents pkgroot/Library/Printers/PPDs/Contents/Resources pkgroot/Users
mkdir pkgroot resources scripts
mkdir -m 775 pkgroot/Library pkgroot/Library/Printers pkgroot/Library/Printers/RWTS
mkdir -m 755 $PDFWRITERDIR pkgroot/Library/Printers/PPDs pkgroot/Library/Printers/PPDs/Contents $PPDDIR pkgroot/Users
mkdir -m 775 pkgroot/Users/Shared
mkdir resources scripts


echo "#### populating directory structure"

iconutil -c icns -o pkgroot/Library/Printers/RWTS/PDFwriter/PDFwriter.icns ../PDFwriter.iconset
cp ../PDFwriterFolder.icns pkgroot/Library/Printers/RWTS/PDFwriter/
clang -Oz -o pkgroot/Library/Printers/RWTS/PDFwriter/pdfwriter -framework appkit ../pdfwriter.m
cp ../uninstall.sh pkgroot/Library/Printers/RWTS/PDFwriter/uninstall.sh
gzip -c ../RWTS\ PDFwriter.ppd > pkgroot/Library/Printers/PPDs/Contents/Resources/RWTS\ PDFwriter.gz
iconutil -c icns -o $PDFWRITERDIR/PDFwriter.icns PDFwriter.iconset
iconutil -c icns -o $PDFWRITERDIR/PDFfolder.icns PDFfolder.iconset
clang -Oz -o $PDFWRITERDIR/pdfwriter -framework appkit -arch x86_64 -mmacosx-version-min=10.9 pdfwriter.m
cp uninstall.sh $PDFWRITERDIR/uninstall.sh
gzip -c "$PPDFILE".ppd > $PPDDIR/"$PPDFILE".gz
ln -s /var/spool/pdfwriter pkgroot/Users/Shared/PDFwriter

chmod 700 pkgroot/Library/Printers/RWTS/PDFwriter/pdfwriter
chmod 755 pkgroot/Library/Printers/RWTS/PDFwriter/uninstall.sh # will be root:admin 750 after postinstall, but this will be ok if permissions are "repaired"
chmod 644 pkgroot/Library/Printers/PPDs/Contents/Resources/RWTS\ PDFwriter.gz
chmod 700 $PDFWRITERDIR/pdfwriter
chmod 755 $PDFWRITERDIR/uninstall.sh # will be root:admin 750 after postinstall, but this will be ok if permissions are "repaired"
chmod 644 $PPDDIR/"$PPDFILE".gz

cp ../PDFWriter.iconset/icon_256x256.png resources/background.png
cp ../../License resources/
cp ../postinstall ../preinstall scripts/
cp PDFWriter.iconset/icon_256x256.png resources/background.png
cp ../License resources/
cp postinstall preinstall scripts/

echo "#### building installer package"

pkgbuild --root pkgroot --identifier au.rwts.pdfwriter --ownership recommended --scripts scripts --version 1.0 pdfwriter.pkg

echo "#### building distribution file"
productbuild --synthesize --resources resources --product ../requirements --package pdfwriter.pkg distribution.dist
productbuild --synthesize --resources resources --product requirements --package pdfwriter.pkg distribution.dist

sed -i "" '3 a\
\ <title>RWTS PDFwriter</title>
' distribution.dist
sed -i "" '4 a\
\ <background file="background.png" alignment="bottomleft" scaling="none"/>
' distribution.dist
sed -i "" '5 a\
sed -i '' '3 a\
\ <title>RWTS PDFwriter</title>\
\ <background file="background.png" alignment="bottomleft" scaling="none"/>\
\ <license file="License"/>
' distribution.dist
' distribution.dist

echo "#### building product"
productbuild --distribution distribution.dist --resources resources --product requirements temp.pkg
productbuild --distribution distribution.dist --resources resources --product requirements product.pkg


# Have to add to installer separately as productbuild can't handle rtfd resources
pkgutil --expand temp.pkg temp-expanded
sed -i "" '6 a\
# Have to add README to installer separately as productbuild can't handle rtfd resources
pkgutil --expand product.pkg expanded
sed -i '' '6 a\
\ <readme file="README.rtfd" />
' temp-expanded/Distribution
' expanded/Distribution

cp -r ../README.rtfd temp-expanded/Resources/
pkgutil --flatten temp-expanded temp2.pkg
cp -r README.rtfd expanded/Resources/
pkgutil --flatten expanded RWTS-PDFwriter.pkg

if [ "$signstring" != "" ]; then echo "#### signing product"; productsign --sign "$signstring" temp2.pkg ../../RWTS-PDFwriter.pkg
else mv temp2.pkg ../../RWTS-PDFwriter.pkg; fi
if [ "$SIGNSTRING" ]; then echo "#### signing product"; productsign --sign "$SIGNSTRING" RWTS-PDFwriter.pkg ../RWTS-PDFwriter.pkg
else mv RWTS-PDFwriter.pkg ../RWTS-PDFwriter.pkg; fi

echo "#### cleaning up"
cd ..
rm -r temp
rm -r pkgroot resources scripts expanded *.pkg distribution.dist
exit 0
11 changes: 10 additions & 1 deletion sources/pdfwriter.m
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/* pdfwriter.m
*
* (c) 2016 Rodney I. Yager
* GPL version 2 or later
*
* Principal change from earlier versions in the addition of an icon to the user spool folder.
*
*/

/* pdfwriter.c
*
* PDFwriter is a CUPS backend for Mac OS X to save a document as PDF file
Expand Down Expand Up @@ -207,7 +216,7 @@ static int create_userdir(struct passwd *passwd, char *userdirname) {
}

// set icon for userdirname
[NSWorkspace.sharedWorkspace setIcon:[NSImage.alloc initByReferencingFile:@"/Library/Printers/RWTS/PDFwriter/PDFwriterFolder.icns"] forFile:[NSString stringWithUTF8String:dirname] options:NSExcludeQuickDrawElementsIconCreationOption];
[NSWorkspace.sharedWorkspace setIcon:[NSImage.alloc initByReferencingFile:@"/Library/Printers/RWTS/PDFwriter/PDFfolder.icns"] forFile:[NSString stringWithUTF8String:dirname] options:NSExcludeQuickDrawElementsIconCreationOption];


log_event(CPDEBUG, "output directory created", dirname);
Expand Down

0 comments on commit 8cfa70b

Please sign in to comment.