-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from KanoComputing/os-updates
Os updates
- Loading branch information
Showing
9 changed files
with
161 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
kano-updater (1.0.1-1) unstable; urgency=low | ||
|
||
* Bumping updater to 1.0.1 | ||
|
||
-- Team Kano <[email protected]> Wed, 07 Mar 2014 21:04:15 +0000 | ||
|
||
kano-updater (1.0-46) unstable; urgency=low | ||
|
||
* Package rebuilt, updated to revision 6c6ffd04. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
kano-updater /usr/bin | ||
expand-rootfs /usr/bin | ||
kano-updater usr/bin | ||
expand-rootfs usr/bin | ||
|
||
pre_update /usr/share/kano-updater | ||
post_update /usr/share/kano-updater | ||
python_modules /usr/share/kano-updater | ||
pre_update usr/share/kano-updater | ||
post_update usr/share/kano-updater | ||
python_modules usr/share/kano-updater | ||
|
||
icon/Updater /usr/share/kano-desktop/extras | ||
icon/kano-updater.png /usr/share/kano-desktop/icons | ||
kano_updater usr/lib/python2.7/dist-packages/ | ||
|
||
icon/Updater usr/share/kano-desktop/extras | ||
icon/kano-updater.png usr/share/kano-desktop/icons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env python | ||
|
||
# kano-extras Python library | ||
# | ||
# Copyright (C) 2014 Kano Computing Ltd. | ||
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2 | ||
|
||
class OSVersion: | ||
@staticmethod | ||
def from_version_string(vstr): | ||
try: | ||
_os, _codename, _number = vstr.split("-") | ||
except: | ||
msg = "Unknown version string format ({})".format(vstr) | ||
raise Exception(msg) | ||
|
||
return OSVersion(_os, _codename, _number) | ||
|
||
@staticmethod | ||
def from_version_file(vfile_path): | ||
with open(vfile_path, "r") as vfile: | ||
vstr = vfile.read().strip() | ||
return OSVersion.from_version_string(vstr) | ||
|
||
def __init__(self, os="Kanux", codename=None, version=None): | ||
self._os = os | ||
self._codename = codename | ||
self._number = version | ||
|
||
def to_issue(self): | ||
return "{} {} {} \\l".format(self._os, self._codename, self._number) | ||
|
||
def to_version_string(self): | ||
return "{}-{}-{}".format(self._os, self._codename, self._number) | ||
|
||
def __str__(self): | ||
return self.to_version_string() | ||
|
||
def __eq__(self, other): | ||
return str(self) == str(other) | ||
|
||
def __lt__(self, other): | ||
return str(self) < str(other) | ||
|
||
def __gt__(self, other): | ||
return str(self) > str(other) | ||
|
||
def __cmp__(self, other): | ||
return cmp(str(self), str(other)) | ||
|
||
def bump_system_version(ver, version_file_path, issue_file_path): | ||
with open(version_file_path, "w") as vfile: | ||
vfile.write(ver.to_version_string() + "\n") | ||
|
||
with open(issue_file_path, "w") as ifile: | ||
ifile.write(ver.to_issue() + "\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# Copyright (C) 2014 Kano Computing Ltd. | ||
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2 | ||
# | ||
|
||
import sys | ||
from kano_updater.OSVersion import OSVersion | ||
|
||
class Update(object): | ||
def __init__(self, up_type): | ||
if len(sys.argv) != 3: | ||
msg = 'Two arguments are required (the old and new versions)\n' | ||
sys.stderr.write(msg) | ||
sys.exit(1) | ||
|
||
self._type = up_type | ||
print 'Runing the {}-update scripts...'.format(up_type) | ||
|
||
self._old = OSVersion.from_version_string(sys.argv[1]) | ||
self._new = OSVersion.from_version_string(sys.argv[2]) | ||
|
||
def get_old(self): | ||
return self._old | ||
|
||
def get_new(self): | ||
return self._new | ||
|
||
def from_to(self, from_v, to_v): | ||
run = self._old == OSVersion.from_version_string(from_v) and \ | ||
self._new == OSVersion.from_version_string(to_v) | ||
if run: | ||
print "Doing {}-update from {} to {}".format(self._type, | ||
from_v, to_v) | ||
return run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env python | ||
|
||
# kano-extras Python library | ||
# | ||
# Copyright (C) 2014 Kano Computing Ltd. | ||
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2 | ||
# | ||
# Utilities for the updater and the pre and post update scripts | ||
|
||
from kano.utils import run_print_output_error | ||
|
||
def install(pkgs): | ||
if isinstance(pkgs, list): | ||
pkgs = ' '.join(pkgs) | ||
|
||
cmd = 'apt-get install -o Dpkg::Options::="--force-confdef" ' + \ | ||
'-o Dpkg::Options::="--force-confold" -y --force-yes ' + str(pkgs) | ||
print cmd | ||
run_print_output_error(cmd) | ||
|
||
def remove(pkgs): | ||
pass #TODO | ||
|
||
|
||
def purge(pkgs): | ||
pass #TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env python | ||
|
||
# kano-extras Python library | ||
# | ||
# Copyright (C) 2014 Kano Computing Ltd. | ||
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2 | ||
|
||
__author__ = 'Kano Computing Ltd.' | ||
__email__ = '[email protected]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
#!/usr/bin/env python | ||
# post_update | ||
# | ||
# Copyright (C) 2014 Kano Computing Ltd. | ||
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2 | ||
# | ||
|
||
from kano_updater.Utils import install, remove, purge | ||
from kano_updater.Update import Update | ||
|
||
update = Update("post") | ||
|
||
if update.from_to('Kanux-Beta-1.0', 'Kanux-Beta-1.0.1'): | ||
install('kano-extras') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
#!/usr/bin/env python | ||
# pre_update | ||
# | ||
# Copyright (C) 2014 Kano Computing Ltd. | ||
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2 | ||
# | ||
|
||
from kano_updater.Utils import install, remove, purge | ||
from kano_updater.Update import Update | ||
|
||
update = Update("pre") | ||
|
||
if update.from_to('Kanux-Beta-1.0', 'Kanux-Beta-1.0.1'): | ||
pass |