Thursday, July 3, 2008

Install Package from terminal

this post will explain how to install packages from command-line interface (terminal or Single User mode),

where to get packages?
first thing you need to do is get the package, if you have downloaded it then cd to its location for instance:
cd /Users/shay/Downloads
if you have it only in the leopard install dvd then cd to the packages location like this:
cd /Volumes/Leo4Allv3-10.5.2/System/Installation/Packages
Note: your dvd name will probably be different then "Leo4Allv3-10.5.2"

next you should create a temp folder where you can work at:
mkdir /mytemp
and copy the desired packages to there:
cp -R powermanagement.pkg
and move to the folder (so each command you execute will be executed in relative to that folder):
cd /mytemp

what is a package?
a package is a compressed file or folder (can come in two forms), that can be executed due to its extensions pkg.
after execution a graphical installer will be launched and after several clicks a script will install files and folders into your hackintosh/Mac system.

how to extract package?
the package file can be extracted into a folder form using a command line tool named pkgutil,
you can check if your package is a flat file package or a directory package like this:
try to: "cd powermanagement.pkg"
if the result is: "-bash: cd: powermanagement.pkg: Not a directory"
then you are dealing with flat file, in order to install it from command line you need the folder form so lets convert it to a folder form, you do it like this:

pkgutil --expand powermanagement.pkg powermanagement_ex.pkg

so now you may "cd powermanagement_ex.pkg" successfully.

what's inside a package?
if you look inside the pkg folder (from finder right click and choose "Show Package Contents") or from command line using the cd command you will find the next folder structure:


the most important files are:
Archive.bom - this file contains information of what is the content of the package, where it should be installed, etc.
Archive.pax.gz - this is the actual content of the package zipped (this is where we are heading)

you may sometimes find in folder Resources a shell scripts that should be run pre install and post install these scripts handle creation of folders, deleting temp files, fix permissions etc.

how to extract package content?
you can expand the Archive.pax.gz in order to get the files and copy them to the destination folder manually (and by that install the package) like this:

(the first cd command is adviced so files and folder extracted will not overwrite existing system files and folder, ofcource you may want to create a new folder and cd to it instead of the myTemp folder)

cd /mytemp
gzip -d powermanagement_ex.pkg/Contents/Archive.pax.gz
pax -r '*' <>

the result will be the contents of the package sorted in the destination folders at the current directory, in this example:


how to manually install the package?
after extracting the content you need to copy each file to its destination,
this package for instance, have System as root of files meaning the kext files should be on your hard drive at /System/Library/Extensions etc.
the simplest way to "install them will be to copy the whole tree like this:

cp -R /mytemp/System /

this will tell leopard to copy the current folder System into the root (so if it exist it will populate it if not it will be copied)

last thing to do is to go over the post install script and see if there are other actions need to be taken as part of the install process, display the content of the script like this:

cat powermanagement_ex.pkg/Contents/Resources/postinstall | more

in this case the script will look like this:

so in this case we need to copy the files to system (we already done that), and fix permissions, a faster way will be to do this:
chmod -R 755 /System/Library/Extensions
chown -R 0:0 /System/Library/Extensions

or even safer like this:
diskutil repairPermissions /System/Library/Extensions

Summary
so lets go over the commands we need to do in order to install powermanagement.pkg from command line:
cd /Volumes/Leo4Allv3-10.5.2/System/Installation/Packages
mkdir /mytemp
cp -R powermanagement.pkg
cd /mytemp
pkgutil --expand powermanagement.pkg powermanagement_ex.pkg
gzip -d powermanagement_ex.pkg/Contents/Archive.pax.gz
pax -r '*' <>always use pacifist or packageutil or simply double click the pkg file if you are in GUI in order to install the package.

is there a difference between manual install and GUI automatic install?
yes, during GUI install the installed package is registered in mac install database and a receipt is kept there with the information of the installed files, location etc. this info may come handy when you want to reinstall, uninstall, or verify that the install is intact.

more then that most install create backup and allow uninstall feature in a later time, although you can do backup, a complex install makes uninstall process almost impossible.

Shay.

Thursday, June 26, 2008

What is MBR and GPT?

If you have encountered a disk problem in hackintosh then, you might came across the terms MBR which is an acronyms for Master Boot Recored and GPT which is an acronyms for GUID Partition Table.

every hard drive is separated into partitions, even if it has only one partition it has a table describing that mapping, that mapping contains data like: how many partition on the drive, what is the size of each partition, what is the starting address of each partition etc. the partition table info can be described in two manners (actually more but we are interested only in these two), the one is MBR and the other is GUID, this manner is named Partition Scheme.

the partition schemes differ from one another by the way it holds the addressing of the partitions (CHS vs LBA), and by the max size they support for each partition, where is the boot recored kept etc. MBR is used in PC that uses a BIOS, GUID is used in computers that support EFI (like Mac). you can read more about it here.

when you install a hackintosh you need to prepare a partition for OSX, if it is a new partition on existing (already partitioned, from windows) disk, then there is no doubt you have an MBR partition scheme (well 99%), but if you prepare the disk from the OSX installation using the Disk Utility, then you have an option to choose from 3 types (MBR, GUID, Apple Partition Table Scheme).

Note 1: Apple Partition Table is not good scheme for a bootable HD for hackintosh, it is mostly for PPC.
Note 2: if you choose to repartition your hard drive from the Disk Utility or any other tool, it will cause loss of all information on that hard drive (including any Windows flavor you have installed on it).

you can repartition your hard drive from leopard installation or existing leopard installation in this way:
open Disk Utility.
right click on the drive you wish to partition from the left hard-drive tree, and choose the "Partition" option.


from the "Volume Scheme" drop-down menu choose the number of partitions you would like to create on the disk.


from the lower "Options..." button choose the desired partition scheme, i would suggest MBR.


if you would like just to know what partition you are currently using then open "Disk Utility".
and from the left hard-drive tree choose the drive you wish to query, (Note: the drive and not its partitions)



then look at the right lower corner next to the label: "Partition Map Scheme" and you will see your partition scheme (Master Boot or GUID)


Shay.

Monday, June 23, 2008

Leopard 10.5.2 in Hebrew


not sure how interesting it is for this blog (more related to my hebrew blog), but i have recently found a package that updates Leopard 10.5.2 interface to fully hebrew interface (it looks strange but some people may like it).


the package works with other versions as well but it supports only half of the available strings (i tried it on a 10.5.3 hackintosh), i haven't found any problems, the only thing that bothered me is that there was no uninstall script, and since the package only adds a hebrew lproj folders to the appropriate applications, bundles, kext, and utils, then it is only a matter of removing them,

i created an uninstall script, backup and restore script for the hebrew lproj that exist before the package install, it will create a folder named "Backup" in the root drive.

before you install:
  1. backup using Time Machine
  2. create a user with english only interface
  3. download the file from this link

to install write these lines in the terminal:
  1. cd /path/to/downloaded/folder
  2. ./backupHebrew.sh
  3. enter your password and press enter
  4. execute the install package: LeopardHebrew.10.5.2.pkg
  5. restart the computer (it may take a minute longer to load, just this time) and if you set your interface to hebrew, you will see hebrew interface.
to uninstall write these lines in the terminal:
  1. ./UnInstallLeopardHbrew.sh
  2. enter your password and press enter
  3. reboot
  4. if problems with hebrew interface occurres (that did not happened before the install) then write:
  5. ./restoreHebrew.sh
more screenshots are available at my hebrew forum at this post,
hope this will be of some use to some one,
Shay.

Saturday, June 21, 2008

OSX86 Library



today Tim Smart published his site "OSX86Library" on insanelymac, the site is meant to be a an HCL database for osx86,
the main idea behind it is to allow people about to buy a new computer to consider the ultimate hardware compatible with OSX86. (like psystar does), the site is still under construction but you can already submit your hardware list, there is an eye candy UI involved you should check it out.

Enjoy.

 
the menu is from: Milonic DHTML menus