Skip to content

Commit

Permalink
Merge pull request #24 from TheNewNormal/v0.2.0
Browse files Browse the repository at this point in the history
V0.2.0
  • Loading branch information
rimusz authored Jul 22, 2016
2 parents 114234e + 85f8139 commit e5ed61f
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/corectl.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
13CAFC2A1D2272B000E57ED4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13CAFC291D2272B000E57ED4 /* AppDelegate.swift */; };
13CAFC2C1D2272B000E57ED4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13CAFC2B1D2272B000E57ED4 /* Assets.xcassets */; };
13CAFC2F1D2272B000E57ED4 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13CAFC2D1D2272B000E57ED4 /* MainMenu.xib */; };
13CFBED91D42990300CD2150 /* wait_for_halt_corectld.command in Resources */ = {isa = PBXBuildFile; fileRef = 13CFBED81D42990300CD2150 /* wait_for_halt_corectld.command */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -72,6 +73,7 @@
13CAFC2B1D2272B000E57ED4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
13CAFC2E1D2272B000E57ED4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
13CAFC301D2272B000E57ED4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
13CFBED81D42990300CD2150 /* wait_for_halt_corectld.command */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = wait_for_halt_corectld.command; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -98,6 +100,7 @@
1375976E1D2C05AA000CB88F /* start_corectld.command */,
134DD75B1D2FEBF100E60CDE /* check_corectld_status.command */,
1318E2031D302A3400EC75E9 /* halt_corectld.command */,
13CFBED81D42990300CD2150 /* wait_for_halt_corectld.command */,
136605361D23CCB200D497A0 /* fetch_latest_iso_alpha.command */,
136605411D23E85800D497A0 /* fetch_latest_iso_beta.command */,
136605421D23E85800D497A0 /* fetch_latest_iso_stable.command */,
Expand Down Expand Up @@ -232,6 +235,7 @@
136605381D23CCB200D497A0 /* fetch_latest_iso_alpha.command in Resources */,
137597671D2BE71C000CB88F /* set_sudo_password.command in Resources */,
134DD75C1D2FEBF100E60CDE /* check_corectld_status.command in Resources */,
13CFBED91D42990300CD2150 /* wait_for_halt_corectld.command in Resources */,
13BC96BE1D2D0351006D27B3 /* check_saved_sudo_password.command in Resources */,
134F3CEC1D2C2270002B9668 /* check_blobs_version.command in Resources */,
134476021D2E5F220035B3B9 /* check_active_vms.command in Resources */,
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions src/corectl/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.9</string>
<string>0.2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>121</string>
<string>125</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
6 changes: 5 additions & 1 deletion src/corectl/ServerControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ func ServerStop() {
task.launchPath = "/usr/local/sbin/corectld"
task.arguments = ["stop"]
task.launch()
task.waitUntilExit()

// run script and wait till corectld.runner stops
runScript("wait_for_halt_corectld.command", arguments: "")


menuItem.menu?.itemWithTag(1)?.title = "Server is off"
menuItem.menu?.itemWithTag(1)?.state = NSOffState
Expand All @@ -99,7 +104,6 @@ func RestartServer() {

// stop corectld server
ServerStop()
ServerStop()

// check for sudo password change and start corectld server
appDelegate().check_and_set_sudo_password("no")
Expand Down
6 changes: 3 additions & 3 deletions src/halt_corectld.command
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# start corectld
# halt corectld

#
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
Expand All @@ -16,5 +16,5 @@ printf '%s\n' "$my_password" | sudo -Sv > /dev/null 2>&1

# kill all corectld processes
sudo pkill -f corectld
sudo pkill -f corectld.store
sudo pkill -f corectld.nameserver
sudo pkill -f corectld.runner

16 changes: 16 additions & 0 deletions src/wait_for_halt_corectld.command
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# halt corectld

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source "${DIR}"/functions.sh

# get password for sudo
my_password=$(security find-generic-password -wa corectl-app)
# reset sudo
sudo -k > /dev/null 2>&1

printf '%s\n' "$my_password" | sudo -Sv > /dev/null 2>&1

# kill all corectld processes
sleep 10
sudo pkill -f corectld.runner

0 comments on commit e5ed61f

Please sign in to comment.