diff options
author | Filipp Lepalaan <filipp@mac.com> | 2016-11-02 11:51:30 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2016-11-02 11:51:30 +0200 |
commit | 282b78dc5decd319ed2284f90fd7716cd395a048 (patch) | |
tree | a281baedd56078dc47133c0241687cabed61c4a5 | |
parent | d5107fb63a688236c4bd8275cb3884c2a58ec2f6 (diff) | |
download | machammer-282b78dc5decd319ed2284f90fd7716cd395a048.tar.gz machammer-282b78dc5decd319ed2284f90fd7716cd395a048.tar.bz2 machammer-282b78dc5decd319ed2284f90fd7716cd395a048.zip |
Added some functions
-rw-r--r-- | machammer/functions.py | 16 | ||||
-rwxr-xr-x | tests.py | 4 |
2 files changed, 17 insertions, 3 deletions
diff --git a/machammer/functions.py b/machammer/functions.py index a52dea0..900569d 100644 --- a/machammer/functions.py +++ b/machammer/functions.py @@ -117,7 +117,7 @@ def enable_ard(username): def sleep(): - """Put this Mac to sleep""" + """Put this Mac to sleep.""" tell_app('Finder', 'sleep') @@ -191,8 +191,8 @@ def install_su(restart=True): def disable_wifi(port='en1'): - subprocess.call(['/usr/sbin/networksetup', '-setairportpower', port, 'off']) - subprocess.call(['/usr/sbin/networksetup', '-setnetworkserviceenabled', 'Wi-Fi', 'off']) + call('/usr/sbin/networksetup', '-setairportpower', port, 'off') + call('/usr/sbin/networksetup', '-setnetworkserviceenabled', 'Wi-Fi', 'off') def log(msg): @@ -205,3 +205,13 @@ def install_service(src): os.mkdir(SERVICEDIR) ditto(src, SERVICEDIR) + + +def clear_xattr(path): + """Clear all extended attributes on path.""" + call('/usr/bin/xattr', '-c', path) + + +def create_os_media(src, dst): + fp = os.path.join(src, 'Contents/Resources/createinstallmedia') + call(fp, '--volume', dst, '--applicationpath', src, '--nointeraction') @@ -96,6 +96,10 @@ class FunctionsTestCase(TestCase): p = mh.mount_image('/Users/filipp/Downloads/AdobeFlashPlayer_22au_a_install.dmg') self.assertEquals(p, '/Volumes/Adobe Flash Player Installer') + def test_create_media(self): + mh.create_os_media('/Applications/Install macOS Sierra.app', + '/Volumes/Untitled') + @skip('This works, trust me.') def test_sleep(self): mh.sleep() |