mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 13:11:28 +00:00
Add DMG creator and checker scripts
This commit is contained in:
124
macosx/check_test.sh
Normal file
124
macosx/check_test.sh
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
export version=$(grep '^\#[ \t]*define[ \t]\+NMAP_VERSION' ../nmap.h | sed -e 's/.*"\(.*\)".*/\1/' -e 'q')
|
||||||
|
export title="nmap-${version}"
|
||||||
|
export disk="/Volumes/${title}"
|
||||||
|
export backgroundPictureName="nmap.png"
|
||||||
|
export finalDMGName="${title}.dmg"
|
||||||
|
export applicationName="${title}.mpkg"
|
||||||
|
RES="True"
|
||||||
|
NB_FILES=7
|
||||||
|
|
||||||
|
hdiutil attach ${finalDMGName}
|
||||||
|
|
||||||
|
# Try to list files in the Volume, if we can't, its because its not ready yet
|
||||||
|
# so we should sleep while its mounted before trying to check if everything is ok
|
||||||
|
stop=false
|
||||||
|
while [ "$stop" = false ]; do
|
||||||
|
test=`ls -l /Volumes/${title}/ | wc -l`
|
||||||
|
if [ "$test" -eq $NB_FILES ]; then
|
||||||
|
stop=true
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "\nDisk: ${disk}"
|
||||||
|
echo "Checking positions...\n"
|
||||||
|
|
||||||
|
export MPKG=`echo '
|
||||||
|
tell application "Finder"
|
||||||
|
set f to POSIX file "'${disk}'/'${applicationName}'" as alias
|
||||||
|
get properties of f
|
||||||
|
end tell
|
||||||
|
' | osascript | grep -o 'position:[0-9]*, [0-9]*' | awk -F':' '{ print $2 }'`
|
||||||
|
|
||||||
|
export README=`echo '
|
||||||
|
tell application "Finder"
|
||||||
|
set f to POSIX file "'${disk}'/'$1'" as alias
|
||||||
|
get properties of f
|
||||||
|
end tell
|
||||||
|
' | osascript | grep -o 'position:[0-9]*, [0-9]*' | awk -F':' '{ print $2 }'`
|
||||||
|
|
||||||
|
export COPYING=`echo '
|
||||||
|
tell application "Finder"
|
||||||
|
set f to POSIX file "'${disk}'/'$2'" as alias
|
||||||
|
get properties of f
|
||||||
|
end tell
|
||||||
|
' | osascript | grep -o 'position:[0-9]*, [0-9]*' | awk -F':' '{ print $2 }'`
|
||||||
|
|
||||||
|
export LICENSES_3RD=`echo '
|
||||||
|
tell application "Finder"
|
||||||
|
set f to POSIX file "'${disk}'/'$3'" as alias
|
||||||
|
get properties of f
|
||||||
|
end tell
|
||||||
|
' | osascript | grep -o 'position:[0-9]*, [0-9]*' | awk -F':' '{ print $2 }'`
|
||||||
|
|
||||||
|
export LICENSES=`echo '
|
||||||
|
tell application "Finder"
|
||||||
|
set f to POSIX file "'${disk}'/'$4'" as alias
|
||||||
|
get properties of f
|
||||||
|
end tell
|
||||||
|
' | osascript | grep -o 'position:[0-9]*, [0-9]*' | awk -F':' '{ print $2 }'`
|
||||||
|
|
||||||
|
if [ "$MPKG" = "$MPKG_POS_X, $MPKG_POS_Y" ]; then
|
||||||
|
echo "${applicationName}: OK"
|
||||||
|
else
|
||||||
|
echo "${applicationName}: Wrong"
|
||||||
|
RES="False"
|
||||||
|
fi;
|
||||||
|
|
||||||
|
if [ "$README" = "$README_POS_X, $README_POS_Y" ]; then
|
||||||
|
echo "README.md: OK"
|
||||||
|
else
|
||||||
|
echo "README.md: Wrong"
|
||||||
|
RES="False"
|
||||||
|
fi;
|
||||||
|
|
||||||
|
if [ "$COPYING" = "$COPYING_POS_X, $COPYING_POS_Y" ]; then
|
||||||
|
echo "COPYING: OK"
|
||||||
|
else
|
||||||
|
echo "COPYING: Wrong"
|
||||||
|
RES="False"
|
||||||
|
fi;
|
||||||
|
|
||||||
|
if [ "$LICENSES_3RD" = "$THIRD_P_POS_X, $THIRD_P_POS_Y" ]; then
|
||||||
|
echo "3rd-party-licenses.txt: OK"
|
||||||
|
else
|
||||||
|
echo "3rd-party-licenses.txt: Wrong"
|
||||||
|
RES="False"
|
||||||
|
fi;
|
||||||
|
|
||||||
|
if [ "$LICENSES" = "$LICENSES_POS_X, $LICENSES_POS_Y" ]; then
|
||||||
|
echo "licenses: OK"
|
||||||
|
else
|
||||||
|
echo "licenses: Wrong"
|
||||||
|
RES="False"
|
||||||
|
fi;
|
||||||
|
|
||||||
|
export BG=`echo '
|
||||||
|
tell application "Finder"
|
||||||
|
set f to POSIX file "'${disk}'/.background/'${backgroundPictureName}'" as alias
|
||||||
|
if exists file f then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end if
|
||||||
|
end tell
|
||||||
|
' | osascript`
|
||||||
|
|
||||||
|
if [ "$BG" = "true" ]; then
|
||||||
|
echo "\nBackground exists: Yes\n"
|
||||||
|
else
|
||||||
|
echo "\nBackground exists: No\n"
|
||||||
|
RES="False"
|
||||||
|
fi;
|
||||||
|
|
||||||
|
hdiutil detach ${disk}
|
||||||
|
|
||||||
|
if [ "$RES" = "True" ]; then
|
||||||
|
echo "\nTest passed?: Yes\n"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "\nTest passed?: No\nThere are some errors that should be corrected\n"
|
||||||
|
exit 1
|
||||||
|
fi;
|
||||||
74
macosx/createdmg.sh
Normal file
74
macosx/createdmg.sh
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
export source=$1
|
||||||
|
export version=$(grep '^\#[ \t]*define[ \t]\+NMAP_VERSION' ../nmap.h | sed -e 's/.*"\(.*\)".*/\1/' -e 'q')
|
||||||
|
export title="nmap-${version}"
|
||||||
|
export size=50000
|
||||||
|
export backgroundPictureName="nmap.png"
|
||||||
|
export finalDMGName="${title}.dmg"
|
||||||
|
export applicationName="${title}.mpkg"
|
||||||
|
NB_FILES=7
|
||||||
|
|
||||||
|
rm -rf ${source}/.background/${backgroundPictureName}
|
||||||
|
rm -rf ${source}/.background/
|
||||||
|
rm -rf pack.temp.dmg
|
||||||
|
rm -rf ${title}.dmg
|
||||||
|
rm -rf ${source}/Applications
|
||||||
|
|
||||||
|
# Copy the background image to the background of the image disk
|
||||||
|
mkdir ${source}/.background/
|
||||||
|
cp ${backgroundPictureName} ${source}/.background/
|
||||||
|
ln -s /Applications ${source}/
|
||||||
|
|
||||||
|
# Ensure that we have no virtual disk currently mounted
|
||||||
|
hdiutil detach /Volumes/${title}/ 2> /dev/null
|
||||||
|
|
||||||
|
hdiutil create -srcfolder "${source}" -volname "${title}" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -ov -format UDRW -size ${size}k pack.temp.dmg
|
||||||
|
|
||||||
|
# Mount the disk image and store the device name
|
||||||
|
export device=$(hdiutil attach -readwrite -noverify -noautoopen "pack.temp.dmg" | egrep '^/dev/' | sed 1q | awk '{print $1}')
|
||||||
|
|
||||||
|
# Try to list files in the Volume, if we can't, its because its not ready yet
|
||||||
|
# so we should sleep while its mounted before trying to design it with Applescript
|
||||||
|
stop=false
|
||||||
|
while [ "$stop" = false ]; do
|
||||||
|
test=`ls -l /Volumes/${title}/ | wc -l`
|
||||||
|
if [ "$test" -eq $NB_FILES ]; then
|
||||||
|
stop=true
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
# Applescript: design the virtual disk image we just mounted
|
||||||
|
echo '
|
||||||
|
tell application "Finder"
|
||||||
|
tell disk "'${title}'"
|
||||||
|
open
|
||||||
|
|
||||||
|
set current view of container window to icon view
|
||||||
|
set toolbar visible of container window to false
|
||||||
|
set statusbar visible of container window to false
|
||||||
|
set the bounds of container window to {100, 100, 1000, 660}
|
||||||
|
set theViewOptions to the icon view options of container window
|
||||||
|
set icon size of theViewOptions to '${ICON_SIZE}'
|
||||||
|
set text size of theViewOptions to '${FONT_SIZE}'
|
||||||
|
set arrangement of theViewOptions to not arranged
|
||||||
|
set background picture of theViewOptions to file ".background:'${backgroundPictureName}'"
|
||||||
|
|
||||||
|
set position of item "'${applicationName}'" of container window to {'${MPKG_POS_X}', '${MPKG_POS_Y}'}
|
||||||
|
set position of item "Applications" of container window to {'${APPS_POS_X}', '${APPS_POS_Y}'}
|
||||||
|
set position of item "'$2'" of container window to {'${README_POS_X}', '${README_POS_Y}'}
|
||||||
|
set position of item "'$3'" of container window to {'${COPYING_POS_X}', '${COPYING_POS_Y}'}
|
||||||
|
set position of item "'$4'" of container window to {'${THIRD_P_POS_X}', '${THIRD_P_POS_Y}'}
|
||||||
|
set position of item "'$5'" of container window to {'${LICENSES_POS_X}', '${LICENSES_POS_Y}'}
|
||||||
|
|
||||||
|
update without registering applications
|
||||||
|
|
||||||
|
close
|
||||||
|
end tell
|
||||||
|
end tell
|
||||||
|
' | osascript
|
||||||
|
|
||||||
|
hdiutil detach ${device}
|
||||||
|
hdiutil convert "pack.temp.dmg" -format UDZO -imagekey zlib-level=9 -o "${finalDMGName}"
|
||||||
|
rm -f pack.temp.dmg
|
||||||
Reference in New Issue
Block a user