Skip to content
This repository has been archived by the owner on May 22, 2019. It is now read-only.

Commit

Permalink
Revert "change files owned by root to user 1000"
Browse files Browse the repository at this point in the history
This reverts commit 395e6ee.
  • Loading branch information
lots0logs committed Nov 27, 2015
1 parent 395e6ee commit 31060ff
Show file tree
Hide file tree
Showing 205 changed files with 1,231 additions and 1,560 deletions.
Empty file modified .arcconfig 100755 → 100644
Empty file.
Empty file modified .gitignore 100755 → 100644
Empty file.
Empty file modified .landscape.yaml 100755 → 100644
Empty file.
Empty file modified .tx/config 100755 → 100644
Empty file.
Empty file modified AUTHORS 100755 → 100644
Empty file.
1 change: 0 additions & 1 deletion CHANGES 100755 → 100644
@@ -1,4 +1,3 @@
[2015-11-24 22:51:29 -0600] fix typo (cherry picked from commit 0a5a7e1) Dustin Falgout {f8521c6}
[2015-11-21 09:41:45 -0600] Merge pull request #470 from ronhuang/taiwan-not-part-of-china Dustin Falgout {3a5074b}
[2015-11-21 22:48:23 +0800] Taiwan is not part of China Ron Huang {e1fb839}
[2015-11-21 13:13:00 +0100] Install lightdm-webkit2-greeter karasu {b9ac894}
Expand Down
Empty file modified CHANGES-0.10.0-0.12.0 100755 → 100644
Empty file.
Empty file modified COPYING 100755 → 100644
Empty file.
Empty file modified README.md 100755 → 100644
Empty file.
Empty file modified TODO.md 100755 → 100644
Empty file.
Empty file modified TRANSLATORS 100755 → 100644
Empty file.
Empty file modified changelog.txt 100755 → 100644
Empty file.
Empty file modified cnchi.desktop 100755 → 100644
Empty file.
72 changes: 22 additions & 50 deletions cnchi/bootinfo.py
Expand Up @@ -66,63 +66,35 @@

def _check_windows(mount_name):
""" Checks for a Microsoft Windows installed """
# FIXME: Windows Vista/7 detection does not work! ##############################################################

detected_os = _("unknown")
paths = []
for windows in WIN_DIRS:
for system in SYSTEM_DIRS:
paths.append(os.path.join(mount_name, windows, system))

for path in paths:
if _check_vista(path):
detected_os = "Windows Vista"
elif _check_win7(path):
detected_os = "Windows 7"
elif _check_winxp(path):
detected_os = "Win XP"
else:
detected_os = _("unknown")

# Search for Windows Vista and 7
for name in WINLOAD_NAMES:
path = os.path.join(mount_name, windows, system, name)
if os.path.exists(path):
with open(path, "rb") as system_file:
lines = system_file.readlines()
for line in lines:
for vista_mark in VISTA_MARKS:
if vista_mark.encode('utf-8') in line:
detected_os = "Windows Vista"
if detected_os == _("unknown"):
for line in lines:
for seven_mark in SEVEN_MARKS:
if seven_mark.encode('utf-8') in line:
detected_os = "Windows 7"
# Search for Windows XP
if detected_os == _("unknown"):
for name in SECEVENT_NAMES:
path = os.path.join(mount_name, windows, system, "config", name)
if os.path.exists(path):
detected_os = "Windows XP"
return detected_os


def _check_vista(system_path):
# Search for Windows Vista
for name in WINLOAD_NAMES:
path = os.path.join(system_path, name)
if os.path.exists(path):
with open(path, "rb") as system_file:
lines = system_file.readlines()
for line in lines:
for vista_mark in VISTA_MARKS:
if vista_mark.encode('utf-8') in line:
return True
return False


def _check_win7(system_path):
# Search for Windows 7
for name in WINLOAD_NAMES:
path = os.path.join(system_path, name)
if os.path.exists(path):
with open(path, "rb") as system_file:
lines = system_file.readlines()
for line in lines:
for seven_mark in SEVEN_MARKS:
if seven_mark.encode('utf-8') in line:
return True
return False


def _check_winxp(system_path):
# Search for Windows XP
for name in SECEVENT_NAMES:
path = os.path.join(system_path, "config", name)
if os.path.exists(path):
return True
return False


@misc.raise_privileges
def _hexdump8081(partition):
try:
Expand Down
4 changes: 2 additions & 2 deletions cnchi/check.py
Expand Up @@ -47,7 +47,7 @@
NM_STATE_CONNECTED_GLOBAL = 70
UPOWER = 'org.freedesktop.UPower'
UPOWER_PATH = '/org/freedesktop/UPower'
MIN_ROOT_SIZE = 8000000000
MIN_ROOT_SIZE = 6000000000


class Check(GtkBaseBox):
Expand Down Expand Up @@ -184,7 +184,7 @@ def has_enough_space():

def is_updated(self):
""" Checks that cnchi version is, at least, latest stable """
if self.updater == None:
if not self.updater:
# Only call updater once
self.updater = updater.Updater(local_cnchi_version=info.CNCHI_VERSION)
return not self.updater.is_remote_version_newer()
Expand Down
55 changes: 11 additions & 44 deletions cnchi/cnchi.py
Expand Up @@ -38,7 +38,6 @@
import gi
import requests
import json

gi.require_version('Gtk', '3.0')
from gi.repository import Gio, Gtk, GObject

Expand All @@ -63,7 +62,7 @@
cmd_line = None

# At least this GTK version is needed
GTK_VERSION_NEEDED = "3.18.0"
GTK_VERSION_NEEDED = "3.16.0"


class CnchiApp(Gtk.Application):
Expand Down Expand Up @@ -107,8 +106,7 @@ def do_activate(self):
window.show()

with open(self.TMP_RUNNING, "w") as tmp_file:
txt = "Cnchi {0}\n{1}\n".format(info.CNCHI_VERSION, os.getpid())
tmp_file.write(txt)
tmp_file.write("Cnchi {0}\n{1}\n".format(info.CNCHI_VERSION, os.getpid()))

# This is unnecessary as show_all is called in MainWindow
# window.show_all()
Expand Down Expand Up @@ -261,9 +259,8 @@ def check_gtk_version():
import show_message as show
show.error(None, text)
except ImportError as import_error:
logging.error(import_error)
finally:
return False
logging.info(text)
return False
else:
logging.info("Using GTK v{0}.{1}.{2}".format(major, minor, micro))

Expand All @@ -279,34 +276,12 @@ def check_pyalpm_version():
txt = txt.format(pyalpm.version(), pyalpm.alpmversion())
logging.info(txt)
except (NameError, ImportError) as err:
try:
import show_message as show
show.error(None, err)
except ImportError as import_error:
logging.error(import_error)
finally:
logging.error(err)
return False
logging.error(err)
sys.exit(1)

return True


def check_iso_version():
""" Hostname contains the ISO version """
from socket import gethostname
hostname = gethostname()
# antergos-year.month-iso
prefix = "antergos-"
suffix = "-iso"
if hostname.startswith(prefix) and hostname.endswith(suffix):
# We're running form the ISO, register which version.
version = hostname[len(prefix):-len(suffix)]
logging.debug("Running from ISO version %s", version)
else:
logging.debug("Not running from ISO")
return True


def parse_options():
""" argparse http://docs.python.org/3/howto/argparse.html """

Expand Down Expand Up @@ -335,6 +310,11 @@ def parse_options():
"-i", "--disable-tryit",
help=_("Disables first screen's 'try it' option"),
action="store_true")
parser.add_argument(
"-m", "--download-module",
help=_("Choose which download module will be used when downloading packages."
" Possible options are 'requests' (default), 'urllib' and 'aria2'"),
nargs='?')
parser.add_argument(
"-n", "--no-check",
help=_("Makes checks optional in check screen"),
Expand Down Expand Up @@ -368,10 +348,6 @@ def parse_options():
"-v", "--verbose",
help=_("Show logging messages to stdout"),
action="store_true")
parser.add_argument(
"-V", "--version",
help=_("Show Cnchi version and quit"),
action="store_true")
parser.add_argument(
"-z", "--z_hidden",
help=_("Show options in development (for developers only, do not use this!)"),
Expand Down Expand Up @@ -472,11 +448,6 @@ def init_cnchi():
global cmd_line
cmd_line = parse_options()


if cmd_line.version:
print(_("Cnchi (Antergos Installer) version {0}").format(info.CNCHI_VERSION))
sys.exit(0)

if cmd_line.force:
misc.remove_temp_files()

Expand All @@ -498,10 +469,6 @@ def init_cnchi():
if not check_pyalpm_version():
sys.exit(1)

# Check ISO version where Cnchi is running from
if not check_iso_version():
sys.exit(1)

# if not cmd_line.disable_update:
# update_cnchi()

Expand Down
7 changes: 4 additions & 3 deletions cnchi/config.py
Expand Up @@ -49,16 +49,19 @@ def __init__(self):
'bootloader_install': True,
'bootloader_installation_successful': False,
'btrfs': False,
'cache': '',
'cnchi': '/usr/share/cnchi/',
'country_name': '',
'country_code': '',
'data': '/usr/share/cnchi/data/',
'desktop': 'gnome',
'desktop_ask': True,
'desktops': [],
'download_module': 'requests',
'enable_alongside': True,
'encrypt_home': False,
'f2fs': False,
'failed_download': False,
'feature_aur': False,
'feature_bluetooth': False,
'feature_cups': False,
Expand Down Expand Up @@ -87,10 +90,9 @@ def __init__(self):
'luks_root_password': "",
'luks_root_volume': "",
'luks_root_device': "",
'partition_mode': 'automatic',
'partition_mode': 'easy',
'password': '',
'rankmirrors_done': False,
'rankmirrors_result': '',
'require_password': True,
'ruuid': '',
'sentry_dsn': '',
Expand All @@ -113,7 +115,6 @@ def __init__(self):
'use_timesyncd': True,
'user_info_done': False,
'username': '',
'xz_cache': [],
'z_hidden': False})

def _get_settings(self):
Expand Down
Empty file modified cnchi/download/aria2.py 100755 → 100644
Empty file.
82 changes: 56 additions & 26 deletions cnchi/download/download.py
Expand Up @@ -42,8 +42,12 @@
sys.path.insert(0, parent_dir)

import pacman.pac as pac

import download.metalink as ml
import download.download_urllib as download_urllib
import download.download_aria2 as download_aria2
import download.download_requests as download_requests

import misc.misc as misc


Expand All @@ -57,24 +61,34 @@ class DownloadPackages(object):
def __init__(
self,
package_names,
pacman_conf_file,
pacman_cache_dir,
download_module='requests',
pacman_conf_file=None,
pacman_cache_dir=None,
cache_dir=None,
settings=None,
callback_queue=None):
""" Initialize DownloadPackages class. Gets default configuration """

self.package_names = package_names
if pacman_conf_file is None:
self.pacman_conf_file = "/etc/pacman.conf"
else:
self.pacman_conf_file = pacman_conf_file

self.pacman_conf_file = pacman_conf_file
self.pacman_cache_dir = pacman_cache_dir
if pacman_cache_dir is None:
self.pacman_cache_dir = "/install/var/cache/pacman/pkg"
else:
self.pacman_cache_dir = pacman_cache_dir

self.settings = settings
if self.settings:
self.xz_cache_dirs = self.settings.get('xz_cache')
if cache_dir is None or not os.path.exists(cache_dir):
# Try to use liveCD cache if none provided
self.cache_dir = "/var/cache/pacman/pkg"
else:
self.xz_cache_dirs = []
self.cache_dir = cache_dir

self.callback_queue = callback_queue
self.settings = settings
self.download_module = download_module
self.package_names = package_names

# Create pacman cache dir (it's ok if it already exists)
os.makedirs(self.pacman_cache_dir, mode=0o755, exist_ok=True)
Expand All @@ -99,13 +113,32 @@ def start(self, metalinks=None):
txt = _("Can't create download package list. Check log output for details")
raise misc.InstallError(txt)

download = download_requests.Download(
self.pacman_cache_dir,
self.xz_cache_dirs,
self.callback_queue)
logging.debug("Using %s module to download packages", self.download_module)

if self.download_module == "aria2":
download = download_aria2.Download(
self.pacman_cache_dir,
self.cache_dir,
self.callback_queue)
elif self.download_module == "urllib":
download = download_urllib.Download(
self.pacman_cache_dir,
self.cache_dir,
self.callback_queue)
else:
if self.download_module != "requests":
logging.debug("Unknown module '%s', Cnchi will use the 'requests' one as default", self.download_module)
download = download_requests.Download(
self.pacman_cache_dir,
self.cache_dir,
self.callback_queue)

if not download.start(self.metalinks):
# When we can't download (even one package), we stop right here
self.settings.set('failed_download', True)
# New: When we can't download (even one package), we stop right here
# Pros: The user will be prompted immediately when a package fails
# to download
# Cons: We won't let alpm to try to download the package itself
txt = _("Can't download needed packages. Cnchi can't continue.")
raise misc.InstallError(txt)

Expand Down Expand Up @@ -155,15 +188,13 @@ def create_metalinks_list(self):
# Update downloads list with the new info from the processed metalink
for key in metalink_info:
if key not in self.metalinks:
self.metalinks[key] = metalink_info[key]
urls = metalink_info[key]['urls']
if self.settings:
# Sort urls based on the mirrorlist we created earlier
sorted_urls = sorted(urls, key=self.url_sort_helper)
self.metalinks[key]['urls'] = sorted_urls
else:
# When testing, settings is not available
self.metalinks[key]['urls'] = urls
# Sort urls based on the mirrorlist we created earlier
sorted_urls = sorted(urls, key=self.url_sort_helper)
self.metalinks[key] = metalink_info[key]
# logging.debug(self.metalinks[key])
self.metalinks[key]['urls'] = sorted_urls
# logging.debug(self.metalinks[key])

# Show progress to the user
processed_packages += 1
Expand Down Expand Up @@ -225,8 +256,7 @@ def queue_event(self, event_type, event_text=""):

dp = DownloadPackages(
package_names=["gedit"],
pacman_conf_file="/etc/pacman.conf",
pacman_cache_dir="/tmp/pkg",
settings=None,
callback_queue=None)
download_module="requests",
cache_dir="",
pacman_cache_dir="/tmp/pkg")
dp.start()
Empty file modified cnchi/download/download_aria2.py 100755 → 100644
Empty file.

0 comments on commit 31060ff

Please sign in to comment.