added slpkg update checksums

This commit is contained in:
Dimitris Zlatanidis 2014-12-29 09:46:02 +02:00
parent cad12200fb
commit e7677c4a39
2 changed files with 10 additions and 2 deletions

View file

@ -25,6 +25,7 @@ from slack.mirrors import mirrors
from url_read import URL
from __metadata__ import (
slpkg_CHECKSUMS_link,
lib_path,
slack_rel
)
@ -39,6 +40,8 @@ def pkg_checksum(binary, repo):
CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "patches/")).reading()
elif repo == "slack_patches" and slack_rel == "current":
CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "")).reading()
elif repo == "slpkg":
CHECKSUMS_md5 = URL(slpkg_CHECKSUMS_link).reading()
else:
lib = '{0}{1}_repo/CHECKSUMS.md5'.format(lib_path, repo)
f = open(lib, "r")

View file

@ -28,6 +28,8 @@ import sys
import tarfile
import subprocess
from checksum import check_md5
from grep_md5 import pkg_checksum
from url_read import URL
from downloader import Download
from __metadata__ import (
@ -60,7 +62,7 @@ def it_self_update():
else:
print("\nNew version '{0}-{1}' is available !\n".format(
__all__, __new_version__))
answer = raw_input("Would you like to continue [Y/n]? ")
answer = raw_input("Would you like to upgrade [Y/n]? ")
if answer in ['y', 'Y']:
print("") # new line after answer
else:
@ -70,11 +72,14 @@ def it_self_update():
__new_version__)]
Download(build_path, dwn_link).start()
os.chdir(build_path)
tar = tarfile.open('v' + __new_version__ + '.tar.gz')
slpkg_tar_file = 'v' + __new_version__ + '.tar.gz'
tar = tarfile.open(slpkg_tar_file)
tar.extractall()
tar.close()
file_name = '{0}-{1}'.format(__all__, __new_version__)
os.chdir(file_name)
check_md5(pkg_checksum(slpkg_tar_file, "slpkg"),
build_path + slpkg_tar_file)
subprocess.call('chmod +x {0}'.format(file_name), shell=True)
subprocess.call('sh install.sh', shell=True)
else: