Skip to content
This repository has been archived by the owner on Feb 27, 2018. It is now read-only.

Commit

Permalink
Merge pull request #71 from huangsam/master
Browse files Browse the repository at this point in the history
Add uninstaller and comply with shellcheck
  • Loading branch information
tianon committed Oct 9, 2014
2 parents 8a8d3c2 + 7893a69 commit 7731ff5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 10 deletions.
20 changes: 10 additions & 10 deletions makedmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,28 @@ else
OUTPUT=$1
TITLE=$2
CONTENTDIR=$3
FILESIZE=`du -sm ${CONTENTDIR} | cut -f1`
FILESIZE=`expr ${FILESIZE} + 5`
USER=`whoami`
FILESIZE=$(du -sm "${CONTENTDIR}" | cut -f1)
FILESIZE=$(("${FILESIZE}" + 5))
USER=$(whoami)
TMPDIR="/tmp/dmgdir"

if [ ${USER} != "root" ]; then
if [ "${USER}" != "root" ]; then
echo "$0 must be run as root!"
else
echo "Creating DMG File..."
dd if=/dev/zero of=${OUTPUT} bs=1M count=$FILESIZE
mkfs.hfsplus -v "${TITLE}" ${OUTPUT}
dd if=/dev/zero of="${OUTPUT}" bs=1M count=$FILESIZE
mkfs.hfsplus -v "${TITLE}" "${OUTPUT}"

echo "Mounting DMG File..."
mkdir -p ${TMPDIR}
mount -t hfsplus -o loop ${OUTPUT} ${TMPDIR}
mount -t hfsplus -o loop "${OUTPUT}" "${TMPDIR}"

echo "Copying content to DMG File..."
cp -R ${CONTENTDIR}/* ${TMPDIR}
cp -R "${CONTENTDIR}"/* "${TMPDIR}"

echo "Unmounting DMG File..."
umount ${TMPDIR}
rm -rf ${TMPDIR}
umount "${TMPDIR}"
rm -rf "${TMPDIR}"

echo "All Done!"
fi
Expand Down
35 changes: 35 additions & 0 deletions uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# Uninstall Script

if [ "$(which boot2docker)" == "" ]; then
echo "boot2docker does not exist on your machine!"
exit 1
fi

if [ "${USER}" != "root" ]; then
echo "$0 must be run as root!"
exit 2
fi

echo "Stopping boot2docker processes..."
boot2docker stop && boot2docker delete

echo "Removing boot2docker executable..."
rm -f /usr/local/bin/boot2docker

echo "Removing boot2docker ISO and socket files..."
rm -rf ~/.boot2docker
rm -rf /usr/local/share/boot2docker

echo "Removing boot2docker SSH keys..."
rm -f ~/.ssh/id_boot2docker*

echo "Removing boot2docker OSX files..."
rm -f /private/var/db/receipts/io.boot2docker.*
rm -f /private/var/db/receipts/io.boot2dockeriso.*

echo "Removing Docker executable..."
rm -f /usr/local/bin/docker

echo "All Done!"

0 comments on commit 7731ff5

Please sign in to comment.