Dmg Linux

admin

Ubuntu is a common variant of Linux, complete with a user-friendly interface and full flexibility in customizing it via the Terminal window. Windows and Linux share the ability to open ISO files, which are similar to DMG files.

For example I have Apache Web server where Mac dmg file is located. I want to modify for every download adding specific readme file, depending on the region where download request is coming from. A special shell script can do this job, but before I need to verify all script steps manually. This article explains how to do it on Centos6 64-bit Linux.

Preparation steps:
1. Install ELRepo (Before installing ELRepo check the current version: http://elrepo.org/tiki/tiki-index.php):


# rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# yum install https://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm


2. Install hfs and hfsplus Apple file system


# yum install kmod-hfs
# yum install kmod-hfsplus

3. install dmg2img utility

Click 'Download' button located on the menu bar or you can 'Right click' & select the 'Download' option. open the photo album. Select the photos which you want to download. /one-drive-download-mac.html. You will see a checkbox at the top right corner when you mouse over the photos. You will be prompted to save the.zip file.


# yum install dmg2img

Resolving problems with dmg2img installation.
4. install genisoimage


# yum install genisoimage

After installation I rebooted my Linux device because it did not see Apple hfs and hfsplus Apple file system.

DMG modification:
Now we need some dmg file to play with. Let us download some, I selected Avast antivirus, you may used other:


curl -O https://install.avcdn.net/mac-av/10_9/AAFM/avast_security_online.dmg

Next we need to convert dmg file to img:


# dmg2img avast_security_online.dmg avast_security_online.img
dmg2img v1.6.2 is derived from dmg2iso by vu1tur ([email protected])
avast_security_online.dmg –> avast_security_online.img
reading property list, 8326 bytes from address 15071232 …
decompressing:
opening partition 0 … 100.00% ok
opening partition 1 … 100.00% ok
opening partition 2 … 100.00% ok
opening partition 3 … 100.00% ok
opening partition 4 … 100.00% ok
opening partition 5 … 100.00% ok
opening partition 6 … 100.00% ok
opening partition 7 … 100.00% ok
Archive successfully decompressed as avast_security_online.img
Image appears to have GUID Partition Table with 1 HFS+ partition.
You should be able to mount it [as root] by:

modprobe hfsplus
mount -t hfsplus -o loop,offset=20480 avast_security_online.img /mnt

Check result of conversion:


# ls -l avast_security_online*
-rw-r–r– 1 root root 15080070 Mar 12 12:19 avast_security_online.dmg
-rw-r–r– 1 root root 18284544 Mar 12 12:24 avast_security_online.img

Create /mnt/dmg directory:

Dmg Linux Usb


# mkdir /mnt/dmg

Mount converted avast_security_online.img to /mnt/dmg directory:


# mount -t hfsplus -o loop,offset=20480 avast_security_online.img /mnt/dmg

Check content of/mnt/dmg directory after mounting:


# ls -l /mnt/dmg
total 12520
-rw-r–r–. 1 506 games 12816864 Feb 25 08:26 Avast Security.pkg
drwxr-xr-x. 1 506 games 3 Feb 25 08:26 com.avast.uninstall.app
Sometime mount produces the following error: “mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error”.

If hfsplus has been installed successfully, check offet and sizelimit values:
# fdisk -l abc.img
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk abc.img: 47 MB, 47226880 bytes, 92240 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt
Disk identifier: 40AD8A9F-9A0A-41E2-85D1-0559B67AE123

# Start End Size Type Name
1 40 92199 45M Apple HFS/HFS+ disk image
#

recalculating output of fdisk, to get the same result as from parted:
Offset: 40*512 = 20480
sizeLimit 45*1024*1024 = 47185920

Now mount it successful:
# mount -v -t hfsplus -o loop,offset=20480,sizelimit=47185920 abc.img /mnt/dmg/
mount: /dev/loop0 mounted on /mnt/dmg

Create /tmp/dmg directory:


# mkdir /tmp/dmg

Copy content of /mnt/dmg directory to /mnt/tmp directory, then copy your readme file to /tmp/dmg directory.
Check /tmp/dmg directory content


# ls /tmp/dmg
Avast Security.pkg com.avast.uninstall.app readme.txt

Create new dmg file from /tmp/dmg directory:


# genisoimage -V “AvastInstallation” -D -R -apple -no-pad -o newAvast.dmg /tmp/dmg

Unmount /mnt/dmg


# umount /mnt/dmg

Testing:
Download newAvast.dmg file on your Mac machine, doulbe click on the file and what you will see:
or check AvastInstallation volume:


# ls -l /Volumes/AvastInstallation/
total 25040
-rw-r–r– 1 root wheel 12816864 Mar 14 12:37 Avast Security.pkg
drwxr-xr-x 3 root wheel 2048 Mar 14 12:37 com.avast.uninstall.app
-rw-r–r– 1 root wheel 0 Mar 14 12:40 readme.txt


File type: Mac OS X Disk Image

Open DMG File

The usage of the DMG file extension is in the context of a mountable disk image file which is generated by the Mac OS X Operating System platform. Once the file is opened, the system will mount it in a virtual disk located on the user's desktop.

This type of file is normally utilized for the distribution of software installation packages for the Macintosh computer system.

Dmg Linux

Prior to the introduction of this file format, the Mac environment utilized the IMG up until the introduction of the Mac OS 9. The Apple Disk Utility is the main application associated by users to this particular file type under the Macintosh platform and is bundled with the Mac OS X installation package.

Although not meant to be directly opened under the Microsoft Windows Operating System platform, the DMG format file can be accessed by Windows users by using some third party applications in the market. Basically, the DMG file extension can be compared to the EXE or ISO format of Windows and can even function as a complete virtual drive for the system.

The mimicking of physical CD drives is a workaround implemented by the system to address problems that may arise from CD requirements of some software programs including support for the efficient usage of an organization's resources.

Detailed information

File format: Proprietary
Open with Windows: Acute Systems TransMac, DMG2IMG or DMG2ISO
The DMG format file is also used by video games distributed for the Macintosh computer environment which are commonly protection enabled.
This format makes sure that all software installation and execution in the system are carried out correctly by providing support for both physical and virtual drives required by the system.
Running an application from a virtual drive may also allow a user to execute a program without actually copying an instance of it in the physical storage drive of the computer system.

Install Dmg Linux

This will save storage space and proves to be advantageous especially for programs which are not used very often. Aside from the Apple tool bundled with the Operating System, other more commonly used utilities that serve as an alternative include MagicISO, IsoBuster, and UltraISO.
These programs are more popularly executed under the Windows environment but are capable of reading DMG file formats and compressing them into another file extension that is more popularly used.

Burn Dmg To Usb

Another example of this conversion program is the DMG2ISO.