Chameleon

Chameleon Commit Details

Date:2015-03-12 05:30:28 (5 years 8 months ago)
Author:ErmaC
Commit:2623
Parents: 2622
Message:Improve getOSVersion (credits to Bronya)
Changes:
M/trunk/i386/libsaio/disk.c

File differences

trunk/i386/libsaio/disk.c
17291729
17301730
17311731
1732
1732
17331733
17341734
17351735
......
17391739
17401740
17411741
1742
1742
17431743
17441744
17451745
......
17531753
17541754
17551755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
17561798
17571799
17581800
......
17601802
17611803
17621804
1763
1805
17641806
17651807
17661808
......
17771819
17781820
17791821
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
18101822
18111823
18121824
if (!loadConfigFile(dirSpec, &systemVersion))
{
bvr->OSisInstaller = true;
bvr->OSisInstaller = false;
valid = true;
}
else
if (!loadConfigFile(dirSpec, &systemVersion))
{
bvr->OSisServer = true;
bvr->OSisServer = false;
valid = true;
}
/*else
}
*/
}
if ( LION )
{
int fh = -1;
snprintf(dirSpec, sizeof(dirSpec), "hd(%d,%d)/.PhysicalMediaInstall", BIOS_DEV_UNIT(bvr), bvr->part_no);
fh = open(dirSpec, 0);
if (fh >= 0)
{
valid = true;
bvr->OSisInstaller = true;
strcpy(bvr->OSVersion, "10.7"); // 10.7 +
close(fh);
}
else
{
close(fh);
}
}
// Mountain Lion ?
if ( MAVERICKS )
{
int fh = -1;
snprintf(dirSpec, sizeof(dirSpec), "hd(%d,%d)/.IAPhysicalMedia", BIOS_DEV_UNIT(bvr), bvr->part_no);
fh = open(dirSpec, 0);
if (fh >= 0)
{
valid = true;
bvr->OSisInstaller = true;
strcpy(bvr->OSVersion, "10.9"); // 10.9 +
}
else
{
close(fh);
}
}
// Yosemite ?
}
if (valid)
const char *val;
int len;
if (getValueForKey(kProductVersion, &val, &len, &systemVersion))
if (getValueForKey(kProductVersion, &val, &len, &systemVersion))
{
// getValueForKey uses const char for val
// so copy it and trim
}
}
if(!valid)
{
int fh = -1;
snprintf(dirSpec, sizeof(dirSpec), "hd(%d,%d)/.PhysicalMediaInstall", BIOS_DEV_UNIT(bvr), bvr->part_no);
fh = open(dirSpec, 0);
if (fh >= 0)
{
valid = true;
bvr->OSisInstaller = true;
strcpy(bvr->OSVersion, "10.7"); // 10.7 +
close(fh);
}
else
{
snprintf(dirSpec, sizeof(dirSpec), "hd(%d,%d)/.IAPhysicalMedia", BIOS_DEV_UNIT(bvr), bvr->part_no);
fh = open(dirSpec, 0);
if (fh >= 0)
{
valid = true;
bvr->OSisInstaller = true;
strcpy(bvr->OSVersion, "10.9"); // 10.9 +
}
else
{
close(fh);
}
}
}
return valid;
}

Archive Download the corresponding diff file

Revision: 2623