Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.0-beta2 #49

Merged
merged 64 commits into from
May 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
2a3bc44
Fixed memory leak for outgoing data (call to IOFree had incorrect par…
nsinenian Jan 27, 2016
b64c0d4
Arbitrary length TLDs supported. Fixed compiler warnings for escape s…
nsinenian Feb 1, 2016
db66fbc
Fix compilation failure due to missing "asl_object_t".
BjoKaSH Feb 1, 2016
dac8a86
Merge pull request #31 from BjoKaSH/fix_asl_compile_error
nsinenian Feb 1, 2016
3bbb9ce
Modified installation path for OS X Mavericks and earlier.
nsinenian Feb 11, 2016
a3bc034
Merge remote-tracking branch 'origin/develop' into develop
nsinenian Feb 11, 2016
30b0df2
Added variable kext install path based on OS X version.
nsinenian Feb 11, 2016
438bd1e
Create /Library/PrivilegedHelperTools/ if it doesn't exist
nsinenian Feb 12, 2016
6cec896
Changed com.apple.pi.mach to 12.6 for compatibility with OS X Mountai…
nsinenian Feb 13, 2016
6a0ca68
errno_t and other fixes for OS X 10.8 and earlier compatibility.
nsinenian Feb 14, 2016
60baf75
Moved errno_t definition to shared types.
nsinenian Feb 14, 2016
fb52d23
Added frameworks (link errors with OS X 10.8)
nsinenian Feb 14, 2016
a76d835
BSD-2 Clause License
nsinenian Feb 14, 2016
ec85c35
Create License.md
nsinenian Feb 14, 2016
0838bfc
Rename License.md to LICENSE.md
nsinenian Feb 14, 2016
ca72d22
Restructured project to isolate shared libraries into a framework. Ch…
nsinenian Mar 6, 2016
b5abac9
Streamline install scripts, update daemon install path to /usr/local/…
nsinenian Mar 12, 2016
4b623a3
Merge remote-tracking branch 'origin/develop' into develop
nsinenian Mar 12, 2016
8a130ac
Prevent iscsid from crashing if kext is not loaded when iscsid starts
nsinenian Mar 13, 2016
a75e4d0
Force kext to load when iscsid starts
nsinenian Mar 13, 2016
e8377c0
Remove daemon plist from old location (pre-install/uninstall)
nsinenian Mar 13, 2016
3331197
Fix package installer scripts to avoid errors if installing over exis…
nsinenian Mar 13, 2016
851ab07
Revert to initial plist setup.
nsinenian Mar 13, 2016
2bdafeb
Update header block
nsinenian Apr 7, 2016
081942e
Removed unnecessary calls to CFStringGetCStringPtr
nsinenian Apr 7, 2016
771760a
Removed CFStringGetCStringPtr
nsinenian Apr 7, 2016
484dbfc
Removed CFStringGetCStringPtr
nsinenian Apr 7, 2016
af0b539
Updated trusted application path (incorrect after installation paths …
nsinenian Apr 7, 2016
68cc5d4
Removed all instances of CFStringGetCStringPtr -> CFStringGetCString
nsinenian Apr 7, 2016
baa9f31
Optimized maximum read/write count & size for compatibility with QNAP…
nsinenian Apr 7, 2016
efe99c6
Fixes bug for special case where immediateData=No, initialR2T=No (dat…
nsinenian Apr 10, 2016
dfc2f94
Sets initialR2T=Yes by default.
nsinenian Apr 10, 2016
9230832
Fix assignment warning.
nsinenian Apr 13, 2016
642f485
Fixed bug that causes iscsictl to crash when login is requested witho…
nsinenian Apr 13, 2016
2ae436a
Set framework ownership to root:wheel
nsinenian Apr 17, 2016
55a8f63
Change in kext build profile (iSCSI.kext)
nsinenian Apr 19, 2016
9d0029e
Updated framework header to include all dependent headers
nsinenian May 1, 2016
c1b2470
Fixed a bug where the plist is set to modified (internally) when retr…
nsinenian May 1, 2016
3a42273
Set session and connection array indices to NULL prior to deallocatin…
nsinenian May 2, 2016
70ea666
Fix memory leak in iSCSIDiscoveryRunSendTargets()
nsinenian May 3, 2016
d0c73d8
Changed connection timeout to 1 sec, moved NULL checks when modifying…
nsinenian May 5, 2016
a4a85eb
Added mutex locks to serialize access to the user client
nsinenian May 5, 2016
48f1bee
Added mutex to serialize access to user client
nsinenian May 5, 2016
68716d1
Added alias to iSCSITarget type
nsinenian May 5, 2016
d0ba563
Fixed bug where lock was potentially released twice
nsinenian May 7, 2016
16b4197
Added ability to associate target alias with a target
nsinenian May 7, 2016
06e90db
Added function: iSCSITargetCreateMutableCopy
nsinenian May 7, 2016
8f472c5
Session layer returns target alias upon login (updates the iSCSITarge…
nsinenian May 7, 2016
eefd20d
Authentication layer supports session layer in returning target alias…
nsinenian May 7, 2016
f30357d
Replaced ..WithExisitng functions with ...Copy to match rest of API
nsinenian May 7, 2016
a0d8f11
Added interval units to discovery-config listing
nsinenian May 7, 2016
39d1b3d
iSCSI authorization rights module (initial commit)
nsinenian May 11, 2016
63f301a
Revamped preferences (formerly property list) to include an opaque ob…
nsinenian May 14, 2016
1c497c2
Updated headers and header names.
nsinenian May 14, 2016
eb7b94f
Code cleanup and documentation
nsinenian May 21, 2016
e1ae13a
Final iteration of the preferences library
nsinenian May 21, 2016
dc4416b
Added callback types for storing iSCSI types in CF containers
nsinenian May 21, 2016
ad630f5
Restructured discovery to run in two segments (functions), allowing a…
nsinenian May 21, 2016
0fab43b
Implemented authorization for login, logout and modify operations. Mo…
nsinenian May 21, 2016
a4d25ea
Removed stale functions (Probe and Reset). Restructured to accommodat…
nsinenian May 21, 2016
bb3d45e
Authorization rights are setup in the daemon upon startup.
nsinenian May 21, 2016
8efdaea
Modified right names
nsinenian May 21, 2016
b1ad725
Changed version to beta2
nsinenian May 21, 2016
f1b46c4
Framework permissions (chmod 755)
nsinenian May 21, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 48 additions & 18 deletions Distribution/Scripts/Installer/postinstall
Original file line number Diff line number Diff line change
@@ -1,35 +1,65 @@
#! /bin/bash

TMP=/tmp
# Define targets
DAEMON=iscsid
TOOL=iscsictl
KEXT=iSCSIInitiator.kext
MAN1=iscsictl.8
MAN2=iscsid.8
FRAMEWORK=iSCSI.framework
DAEMON_PLIST=com.github.iscsi-osx.iscsid.plist
DAEMON_PLIST_NOEXT=com.github.iscsi-osx.iscsid
MAN_TOOL=iscsictl.8
MAN_DAEMON=iscsid.8

# Define install path
DAEMON_DST=/usr/local/libexec
DAEMON_PLIST_DST=/Library/LaunchDaemons
FRAMEWORK_DST=/Library/Frameworks
TOOL_DST=/usr/local/bin
MAN_DST=/usr/share/man/man8

TMP=/tmp

# Get minor version of the OS
OSX_MINOR_VER=$(sw_vers -productVersion | awk -F '.' '{print $2}')

# Minor version of OS X Mavericks
OSX_MAVERICKS_MINOR_VER="9"

if [ "$OSX_MINOR_VER" -ge "$OSX_MAVERICKS_MINOR_VER" ]; then
KEXT_DST=/Library/Extensions
else
KEXT_DST=/System/Library/Extensions
fi

# Copy kernel extensions & load it
sudo cp -R $TMP/$KEXT /Library/Extensions/$KEXT
sudo chmod -R 755 /Library/Extensions/$KEXT
sudo chown -R root:wheel /Library/Extensions/$KEXT
sudo cp -R $TMP/$KEXT $KEXT_DST/$KEXT
sudo chmod -R 755 $KEXT_DST/$KEXT
sudo chown -R root:wheel $KEXT_DST/$KEXT

# Copy framework
sudo cp -R $TMP/$FRAMEWORK $FRAMEWORK_DST/$FRAMEWORK
sudo chown -R root:wheel $FRAMEWORK_DST/$FRAMEWORK
sudo chmod -R 755 $FRAMEWORK_DST/$FRAMEWORK

# Copy daemon & set permissions
sudo cp $TMP/$DAEMON /Library/PrivilegedHelperTools/$DAEMON
sudo cp $TMP/com.github.iscsi-osx.iscsid.plist /System/Library/LaunchDaemons/com.github.iscsi-osx.iscsid.plist
sudo chmod -R 744 /usr/local/$DAEMON
sudo chmod 644 /System/Library/LaunchDaemons/com.github.iscsi-osx.iscsid.plist
sudo chown root:wheel /System/Library/LaunchDaemons/com.github.iscsi-osx.iscsid.plist
sudo mkdir -p $DAEMON_DST
sudo cp $TMP/$DAEMON $DAEMON_DST/$DAEMON
sudo cp $TMP/$DAEMON_PLIST $DAEMON_PLIST_DST/$DAEMON_PLIST
sudo chmod -R 744 $DAEMON_DST/$DAEMON
sudo chmod 644 $DAEMON_PLIST_DST/$DAEMON_PLIST
sudo chown root:wheel $DAEMON_PLIST_DST/$DAEMON_PLIST

# Copy user tool
sudo cp $TMP/$TOOL /usr/local/bin/$TOOL
sudo chmod +x /usr/local/bin/$TOOL
sudo cp $TMP/$TOOL $TOOL_DST/$TOOL
sudo chmod +x $TOOL_DST/$TOOL

# Copy man pages
sudo cp $TMP/$MAN1 /usr/share/man/man8
sudo cp $TMP/$MAN2 /usr/share/man/man8
sudo cp $TMP/$MAN_TOOL $MAN_DST
sudo cp $TMP/$MAN_DAEMON $MAN_DST

# Load kernel extension
sudo kextload /Library/Extensions/$KEXT
sudo kextload $KEXT_DST/$KEXT

# Start daemon
sudo launchctl load /System/Library/LaunchDaemons/com.github.iscsi-osx.iscsid.plist
sudo launchctl start com.github.iscsi-osx.iscsid
sudo launchctl load $DAEMON_PLIST_DST/$DAEMON_PLIST
sudo launchctl start $DAEMON_PLIST_NOEXT
59 changes: 50 additions & 9 deletions Distribution/Scripts/Installer/preinstall
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,63 @@
DAEMON=iscsid
TOOL=iscsictl
KEXT=iSCSIInitiator.kext
FRAMEWORK=iSCSI.framework
DAEMON_PLIST=com.github.iscsi-osx.iscsid.plist
DAEMON_PLIST_NOEXT=com.github.iscsi-osx.iscsid.plist
MAN_TOOL=iscsictl.8
MAN_DAEMON=iscsid.8

# Define install path
DAEMON_DST=/usr/local/libexec
DAEMON_PLIST_DST=/Library/LaunchDaemons
FRAMEWORK_DST=/Library/Frameworks
TOOL_DST=/usr/local/bin
MAN_DST=/usr/share/man/man8

# Get minor version of the OS
OSX_MINOR_VER=$(sw_vers -productVersion | awk -F '.' '{print $2}')

# Minor version of OS X Mavericks
OSX_MAVERICKS_MINOR_VER="9"

if [ "$OSX_MINOR_VER" -ge "$OSX_MAVERICKS_MINOR_VER" ]; then
KEXT_DST=/Library/Extensions
else
KEXT_DST=/System/Library/Extensions
fi

# Stop, unload and remove launch daemon
sudo launchctl stop /System/Library/LaunchDaemons/com.github.iscsi-osx.iscsid
sudo launchctl unload /System/Library/LaunchDaemons/com.github.iscsi-osx.iscsid.plist
sudo rm -f /System/Library/LaunchDaemons/com.github.iscsi-osx.iscsid.plist
sudo launchctl stop $DAEMON_PLIST_NOEXT

if [ -f $DAEMON_PLIST_DST/$DAEMON_PLIST ]; then
sudo launchctl unload $DAEMON_PLIST_DST/$DAEMON_PLIST
fi

sudo rm -f $DAEMON_PLIST_DST/$DAEMON_PLIST
sudo rm -f /usr/sbin/$DAEMON # Old location
sudo rm -f /Library/PrivilegedHelperTools/$DAEMON
sudo rm -f /System/Library/LaunchDaemons/$DAEMON_PLIST # Old location
sudo rm -f $DAEMON_DST/$DAEMON

# Unload & remove kernel extension
sudo kextunload /Library/Extensions/$KEXT
sudo rm -f -R /Library/Extensions/$KEXT
if [ -f $KEXT_DST/$KEXT ]; then
sudo kextunload $KEXT_DST/$KEXT
fi

sudo rm -f -R $KEXT_DST/$KEXT

# Remove user tools
sudo rm -f /usr/bin/$TOOL # Old location
sudo rm -f /usr/local/bin/$TOOL
sudo rm -f $TOOL_DST/$TOOL

# Remove man pages
sudo rm -f /usr/share/man/man8/iscsictl.8
sudo rm -f /usr/share/man/man8/iscsid.8
sudo rm -f $MAN_DST/$MAN_TOOL
sudo rm -f $MAN_DST/$MAN_DAEMON

# Remove framework
sudo rm -f -R $FRAMEWORK_DST/$FRAMEWORK

PKG_RSP="$(pkgutil --pkgs=com.github.iscsi-osx.iSCSIInitiator)"

if [ "$PKG_RSP" == "com.github.iscsi-osx.iSCSIInitiator" ]; then
sudo pkgutil --forget com.github.iscsi-osx.iSCSIInitiator
fi
59 changes: 49 additions & 10 deletions Distribution/Scripts/Uninstaller/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,63 @@
DAEMON=iscsid
TOOL=iscsictl
KEXT=iSCSIInitiator.kext
FRAMEWORK=iSCSI.framework
DAEMON_PLIST=com.github.iscsi-osx.iscsid.plist
DAEMON_PLIST_NOEXT=com.github.iscsi-osx.iscsid.plist
MAN_TOOL=iscsictl.8
MAN_DAEMON=iscsid.8

# Define install path
DAEMON_DST=/usr/local/libexec
DAEMON_PLIST_DST=/Library/LaunchDaemons
FRAMEWORK_DST=/Library/Frameworks
TOOL_DST=/usr/local/bin
MAN_DST=/usr/share/man/man8

# Get minor version of the OS
OSX_MINOR_VER=$(sw_vers -productVersion | awk -F '.' '{print $2}')

# Minor version of OS X Mavericks
OSX_MAVERICKS_MINOR_VER="9"

if [ "$OSX_MINOR_VER" -ge "$OSX_MAVERICKS_MINOR_VER" ]; then
KEXT_DST=/Library/Extensions
else
KEXT_DST=/System/Library/Extensions
fi

# Stop, unload and remove launch daemon
sudo launchctl stop /System/Library/LaunchDaemons/com.github.iscsi-osx.iscsid
sudo launchctl unload /System/Library/LaunchDaemons/com.github.iscsi-osx.iscsid.plist
sudo rm -f /System/Library/LaunchDaemons/com.github.iscsi-osx.iscsid.plist
sudo launchctl stop $DAEMON_PLIST_NOEXT

if [ -f $DAEMON_PLIST_DST/$DAEMON_PLIST ]; then
sudo launchctl unload $DAEMON_PLIST_DST/$DAEMON_PLIST
fi

sudo rm -f $DAEMON_PLIST_DST/$DAEMON_PLIST
sudo rm -f /usr/sbin/$DAEMON # Old location
sudo rm -f /Library/PrivilegedHelperTools/$DAEMON
sudo rm -f /System/Library/LaunchDaemons/$DAEMON_PLIST # Old location
sudo rm -f $DAEMON_DST/$DAEMON

# Unload & remove kernel extension
sudo kextunload /Library/Extensions/$KEXT
sudo rm -f -R /Library/Extensions/$KEXT
if [ -f $KEXT_DST/$KEXT ]; then
sudo kextunload $KEXT_DST/$KEXT
fi

sudo rm -f -R $KEXT_DST/$KEXT

# Remove user tools
sudo rm -f /usr/bin/$TOOL # Old location
sudo rm -f /usr/local/bin/$TOOL
sudo rm -f $TOOL_DST/$TOOL

# Remove man pages
sudo rm -f /usr/share/man/man8/iscsictl.8
sudo rm -f /usr/share/man/man8/iscsid.8
sudo rm -f $MAN_DST/$MAN_TOOL
sudo rm -f $MAN_DST/$MAN_DAEMON

# Remove framework
sudo rm -f -R $FRAMEWORK_DST/$FRAMEWORK

PKG_RSP="$(pkgutil --pkgs=com.github.iscsi-osx.iSCSIInitiator)"

pkgutil --forget com.github.iscsi-osx.iSCSIInitiator
if [ "$PKG_RSP" == "com.github.iscsi-osx.iSCSIInitiator" ]; then
sudo pkgutil --forget com.github.iscsi-osx.iSCSIInitiator
fi
21 changes: 11 additions & 10 deletions Distribution/package.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Package parameters
NAME="iSCSI Initiator for OS X"
BUNDLE_ID="com.github.iscsi-osx.iSCSIInitiator"
VERSION=$(cd ../ ; agvtool what-version -terse)
VERSION="1.0.0-beta2"

# Output of final DMG
RELEASE="../Release"
Expand Down Expand Up @@ -43,7 +43,7 @@ REQUIREMENTS_PATH="Resources/Requirements.plist"

# Relelase build of all three components
xcodebuild -workspace ../iSCSIInitiator.xcodeproj/project.xcworkspace \
-scheme iSCSIInitiator -configuration release BUILD_DIR=$XCODE_RELEASE_BUILD_DIR
-scheme iSCSI.kext -configuration release BUILD_DIR=$XCODE_RELEASE_BUILD_DIR
xcodebuild -workspace ../iSCSIInitiator.xcodeproj/project.xcworkspace \
-scheme iscsid -configuration release BUILD_DIR=$XCODE_RELEASE_BUILD_DIR
xcodebuild -workspace ../iSCSIInitiator.xcodeproj/project.xcworkspace \
Expand All @@ -68,28 +68,29 @@ pkgbuild --nopayload \
--version $VERSION \
$UNINSTALLER_PATH.tmp


# Put packages inside a product archive
productbuild --distribution $INSTALLER_DIST_XML \
--package-path $TMP_PACKAGE_DIR \
--product $REQUIREMENTS_PATH \
$INSTALLER_PATH
--package-path $TMP_PACKAGE_DIR \
--product $REQUIREMENTS_PATH \
$INSTALLER_PATH

productbuild --distribution $UNINSTALLER_DIST_XML \
--package-path $TMP_PACKAGE_DIR \
--product $REQUIREMENTS_PATH \
$UNINSTALLER_PATH
--package-path $TMP_PACKAGE_DIR \
--product $REQUIREMENTS_PATH \
$UNINSTALLER_PATH

# Cleanup temporary packages, leaving final pacakges for DMG
rm $INSTALLER_PATH.tmp
rm $UNINSTALLER_PATH.tmp

# Build the DMG
hdiutil create -srcfolder $TMP_PACKAGE_DIR -volname "$NAME" -fs HFS+ \
-fsargs "-c c=64,a=16,e=16" -format UDRW -size ${DMG_SIZE}k $TMP_ROOT/$DMG_BASE_NAME.dmg
-fsargs "-c c=64,a=16,e=16" -format UDRW -size ${DMG_SIZE}k $TMP_ROOT/$DMG_BASE_NAME.dmg

# Load the DMG
device=$(hdiutil attach -readwrite -noverify -noautoopen $TMP_ROOT/$DMG_BASE_NAME.dmg | \
egrep '^/dev/' | sed 1q | awk '{print $1}')
egrep '^/dev/' | sed 1q | awk '{print $1}')

sleep 2

Expand Down
23 changes: 23 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Copyright (c) 2016, Nareg Sinenian
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 1 addition & 1 deletion Scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
xcodebuild -workspace ../iSCSIInitiator.xcodeproj/project.xcworkspace -scheme iscsid build
xcodebuild -workspace ../iSCSIInitiator.xcodeproj/project.xcworkspace -scheme iscsictl build
xcodebuild -workspace ../iSCSIInitiator.xcodeproj/project.xcworkspace -scheme iSCSIInitiator build
xcodebuild -workspace ../iSCSIInitiator.xcodeproj/project.xcworkspace -scheme iSCSI.kext build
Loading