qvm-template: Slight improvements to package verification.

This commit is contained in:
WillyPillow 2020-08-10 01:30:31 +08:00
parent ed8fca6494
commit b7a603b9fe
No known key found for this signature in database
GPG Key ID: 3839E194B1415A9C

View File

@ -721,9 +721,6 @@ def install(
if not package_hdr: if not package_hdr:
parser.error('Package \'%s\' verification failed.' % rpmfile) parser.error('Package \'%s\' verification failed.' % rpmfile)
if reponame != '@commandline':
os.rename(path, rpmfile)
package_name = package_hdr[rpm.RPMTAG_NAME] package_name = package_hdr[rpm.RPMTAG_NAME]
if not package_name.startswith(PACKAGE_NAME_PREFIX): if not package_name.startswith(PACKAGE_NAME_PREFIX):
parser.error( parser.error(
@ -731,6 +728,9 @@ def install(
# Remove prefix to get the real template name # Remove prefix to get the real template name
name = package_name[len(PACKAGE_NAME_PREFIX):] name = package_name[len(PACKAGE_NAME_PREFIX):]
if path != rpmfile:
os.rename(path, rpmfile)
# Check if already installed # Check if already installed
if not override_existing and name in app.domains: if not override_existing and name in app.domains:
print(('Template \'%s\' already installed, skipping...' print(('Template \'%s\' already installed, skipping...'