Skip to content

Commit

Permalink
editorconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
mslattery-lilly committed Aug 13, 2020
1 parent 3650236 commit 9ca89c5
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 47 deletions.
13 changes: 9 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,25 @@ root = true
[*]
indent_style = space
insert_final_newline = true
indent_size = 4
trim_trailing_whitespace = true
end_of_line = lf

[*.{cmd,bat}]
end_of_line = crlf
indent_size = 4

[*.{ps1,psm1,psd1,nsi}]
end_of_line = crlf
indent_size = 4
trim_trailing_whitespace = true

[*.{ps1xml,props,xml.yaml,yml}]
indent_size = 2

[*.sh]
end_of_line = lf
indent_size = 2

[*.md]
indent_size = undef

[{LICENSE,garbage.txt}]
indent_size = undef
trim_trailing_whitespace = undef
4 changes: 1 addition & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* text=auto
* text=auto eol=lf

*.nsi text eof=crlf
*.ps1 text eol=crlf
Expand All @@ -7,5 +7,3 @@
*.cmd text eol=crlf
*.bat text eol=crlf

*.sh text eol=lf

15 changes: 8 additions & 7 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class FieldBox(Gtk.Frame):
def __init__(self, title):
Gtk.Frame.__init__(self)
self.set_label(title)

self.grid = Gtk.Grid(row_spacing=5, column_spacing=5)
self.row = 0

Expand All @@ -36,7 +36,7 @@ def entry(self, label_text):
class ButtonBox(Gtk.FlowBox):
def __init__(self):
Gtk.FlowBox.__init__(self)

def field(self, field):
self.add(field)
return field
Expand Down Expand Up @@ -70,8 +70,8 @@ def __init__(self):

box = self.FieldBox('')
self.distro = box.field('Distro', Gtk.ComboBoxText())
self.distro.append('1', 'Ubuntu 18.04')
self.distro.append('2', 'Linux Mint 13.3')
self.distro.append('1', 'Ubuntu 20.04')
self.distro.append('2', 'Linux Mint 19.3')
self.distro.set_active(0)
column.add(box)

Expand Down Expand Up @@ -182,7 +182,7 @@ def set_system_info(self, system_info):
self.username.set_text(system_info['username'])
self.hostname.set_text(system_info['hostname'])
self.full_name.set_text(system_info['full_name'])

# OS specific functionality
class LinuxSystem:

Expand All @@ -197,9 +197,10 @@ def get_system_info(self):
'full_name': pwd.getpwuid( uid ).pw_gecos.split(',')[0],
'hostname': platform.node(),
'memory': psutil.virtual_memory().total,
'timezone': '/'.join(os.path.realpath('/etc/localtime').split('/')[-2:]),
'on_battery': not psutil.sensors_battery().power_plugged,
'architecture': platform.machine(),
# These are the only os-specific iems
'timezone': '/'.join(os.path.realpath('/etc/localtime').split('/')[-2:]),
'is_efi': os.path.isdir('/sys/firmware/efi'),
}

Expand All @@ -212,7 +213,7 @@ def get_disk_info(self):
'free': usage.free,
'available': usage.free,
}

# Checks for conditions specific to current OS.
# Throws exception if Tunic not compatible.
def special_checks(self):
Expand Down
46 changes: 23 additions & 23 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@ def get_long_description():


setup(name='tunic',
version=VERSION,
description='Install Linux from Windows',
long_description=get_long_description(),
author='Mike Slattery',
license='GNU GPL v3',
packages=[],
url='https://github.com/mikeslattery/tunic',
entry_points={
"gui_scripts": [
"halo-weather = halo.__main__:main",
]
},
install_requires=[
"requests",
],
data_files=[
# (os.getenv('HOME') + '/.local/share/applications', ['halo.desktop']),
# (os.getenv('HOME') + '/.local/share/icons', ['halo/assets/halo.svg']),
],
package_data={
# '': ['*.css', 'assets/*.*', 'assets/icon/*']
},
zip_safe=False)
version=VERSION,
description='Install Linux from Windows',
long_description=get_long_description(),
author='Mike Slattery',
license='GNU GPL v3',
packages=[],
url='https://github.com/mikeslattery/tunic',
entry_points={
"gui_scripts": [
"halo-weather = halo.__main__:main",
]
},
install_requires=[
"requests",
],
data_files=[
# (os.getenv('HOME') + '/.local/share/applications', ['halo.desktop']),
# (os.getenv('HOME') + '/.local/share/icons', ['halo/assets/halo.svg']),
],
package_data={
# '': ['*.css', 'assets/*.*', 'assets/icon/*']
},
zip_safe=False)

12 changes: 6 additions & 6 deletions test/test-setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $password='Passw0rd!'

$WindowsUpdatePath = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate"
$AutoUpdatePath = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU"

Remove-Item -Path $WindowsUpdatePath -Recurse -errorAction ignore

New-Item -Path $WindowsUpdatePath
Expand Down Expand Up @@ -62,11 +62,11 @@ New-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies

# Disable Cortana

$path = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
IF(!(Test-Path -Path $path)) {
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "Windows Search"
}
Set-ItemProperty -Path $path -Name "AllowCortana" -Value 1
$path = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
IF(!(Test-Path -Path $path)) {
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "Windows Search"
}
Set-ItemProperty -Path $path -Name "AllowCortana" -Value 1
New-NetFirewallRule -DisplayName "Block Cortana Web Access" -Direction Outbound -Program "%windir%\systemapps\Microsoft.Windows.Cortana_cw5n1h2txyewy\SearchUI.exe" -Action Block

# Auto Login
Expand Down
8 changes: 4 additions & 4 deletions tunic.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ function openUrl($url) {

# Returns true if Linux can be installed.
function checks() {
if( !([Security.Principal.WindowsPrincipal] `
[Security.Principal.WindowsIdentity]::GetCurrent() `
if( !( [Security.Principal.WindowsPrincipal] `
[Security.Principal.WindowsIdentity]::GetCurrent() `
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) ) {
die( 'Must be an Administrator to run tunic' )
return
Expand Down Expand Up @@ -1154,8 +1154,8 @@ function hideConsole() {
}

function uninstall() {
if( !([Security.Principal.WindowsPrincipal] `
[Security.Principal.WindowsIdentity]::GetCurrent() `
if( ! ([Security.Principal.WindowsPrincipal] `
[Security.Principal.WindowsIdentity]::GetCurrent() `
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) ) {
write-host 'Must be an Administrator'
exit 1
Expand Down

0 comments on commit 9ca89c5

Please sign in to comment.