--- SSHFS-Mountlet/create_dmg 2024/04/30 09:05:49 1.3 +++ SSHFS-Mountlet/create_dmg 2024/05/15 01:42:19 1.4 @@ -1,20 +1,43 @@ #!/bin/bash +# go home +PWD="$(pwd)" +cd "$(dirname "${BASH_SOURCE[0]}")" +if [ $? -ne 0 ]; then echo "Can't go home." && exit 1; fi + +# set DMG name sshfs_mountlet_dmg="sshfs-mountlet_v$(grep -m 1 "VERSION=" SSHFS-Mountlet/src/sshfs-mountlet | sed -e "s/^.*VERSION=\"//" -e "s/\"$//").dmg" +# create dist directory +if [ ! -e dist ]; then + mkdir dists +fi + +# remove existing DMG of same version if [ -e "dist/$sshfs_mountlet_dmg" ]; then rm "dist/$sshfs_mountlet_dmg" fi + +# delete CVS dirs +if [ ! -e .orig ]; then + find SSHFS-Mountlet -type d -name CVS -exec rm -fr {} \; + find SSHFS-Mountlet -type f -name .DS_Store -delete +fi + +# create DMG hdiutil create "dist/$sshfs_mountlet_dmg" -volname SSHFS-Mountlet -fs HFS+ -srcfolder SSHFS-Mountlet +# relink cd dist rm changelog README license.txt ln ../SSHFS-Mountlet/changelog ln ../SSHFS-Mountlet/README ln ../SSHFS-Mountlet/license.txt +# calculate sha256 sums if [ -e "sha256" ]; then rm sha256 fi shasum -a 256 * > sha256 -cd .. + +cd "$PWD"