Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 684816 Details for
Bug 683104
sys-apps/smartmontools: Merging new version doesn't update existing drivedb.h
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for sys-apps/smartmontools-7.2
smartmontools-7.2-update-drivedb-intelligently.patch (text/plain), 5.02 KB, created by
Will Simoneau
on 2021-01-26 17:23:31 UTC
(
hide
)
Description:
patch for sys-apps/smartmontools-7.2
Filename:
MIME Type:
Creator:
Will Simoneau
Created:
2021-01-26 17:23:31 UTC
Size:
5.02 KB
patch
obsolete
>From af6ea6c593acd3220826fe8d6e5f2a0f5e255331 Mon Sep 17 00:00:00 2001 >From: Will Simoneau <simoneau@ele.uri.edu> >Date: Tue, 26 Jan 2021 11:24:20 -0500 >Subject: [PATCH] sys-apps/smartmontools: Update drivedb.h intelligently by > comparing file mtimes > >--- > .../smartmontools/smartmontools-7.2.ebuild | 111 +++++++++++++----- > 1 file changed, 84 insertions(+), 27 deletions(-) > >diff --git a/sys-apps/smartmontools/smartmontools-7.2.ebuild b/sys-apps/smartmontools/smartmontools-7.2.ebuild >index 8743a731e87..cbb8286e4c9 100644 >--- a/sys-apps/smartmontools/smartmontools-7.2.ebuild >+++ b/sys-apps/smartmontools/smartmontools-7.2.ebuild >@@ -118,34 +118,91 @@ src_install() { > > pkg_postinst() { > if use daemon || use update-drivedb; then >- local initial_db_file="${EROOT}usr/share/${PN}/drivedb.h" >- local db_path="${EROOT}var/db/${PN}" >- >- if [[ ! -f "${db_path}/drivedb.h" ]] ; then >- # No initial database found >- cp "${initial_db_file}" "${db_path}" || die >- einfo "Default drive database which was shipped with this release of ${PN}" >- einfo "has been installed to '${db_path}'." >- else >- ewarn "WARNING: There's already a drive database in '${db_path}'!" >- ewarn "Because we cannot determine if this database is untouched" >- ewarn "or was modified by the user you have to manually update the" >- ewarn "drive database:" >- ewarn "" >- ewarn "a) Replace '${db_path}/drivedb.h' by the database shipped with this" >- ewarn " release which can be found in '${initial_db_file}', i.e." >- ewarn "" >- ewarn " cp \"${initial_db_file}\" \"${db_path}\"" >- ewarn "" >- ewarn "b) Run the following command as root:" >- ewarn "" >- ewarn " /usr/sbin/update-smart-drivedb" >- >- if ! use update-drivedb ; then >- ewarn "" >- ewarn "However, 'update-smart-drivedb' requires that you re-emerge ${PN}" >- ewarn "with USE='update-drivedb'." >+ local shipped_db_file="${EROOT}usr/share/${PN}/drivedb.h" >+ local sys_db_path="${EROOT}var/db/${PN}" >+ local sys_db_file="${sys_db_path}/drivedb.h" >+ >+ if [[ -L "${sys_db_file}" ]]; then >+ # If the system has an existing drivedb.h but it is a symlink, >+ # the sysadmin has presumably done something special with it. >+ # For example, the symlink might point to a drivedb.h within >+ # a checked-out SCM repo for system config files. >+ # >+ # We should respect the sysadmin's specialized configuration by >+ # leaving the existing symlink as-is. >+ >+ ewarn "Preserving existing symlink ${sys_db_file}." >+ >+ elif [[ -f "${sys_db_file}" ]]; then >+ if [[ ! -w "${sys_db_file}" ]] || >+ ! (( 0$(stat -c %a "${sys_db_file}") & 0200 )) >+ then >+ # If the system has an existing drivedb.h but it is not >+ # writable, then the sysadmin presumably doesn't want us >+ # to change it. >+ # Respect that by leaving the existing drivedb.h as-is. >+ >+ ewarn "Existing ${sys_db_file} is not writable;" >+ ewarn "leaving it as-is." >+ >+ else >+ # If the system has an existing drivedb.h and it is a >+ # writable regular file, compare its mtime with the mtime >+ # of the shipped drivedb.h file. >+ # >+ # Comparing file timestamps is admittedly a rather crude way >+ # to compare file versions, but it is still an improvement >+ # over not trying to compare them at all. >+ >+ if [[ "${shipped_db_file}" -nt "${sys_db_file}" ]]; then >+ # Shipped drivedb.h is newer than system drivedb.h. >+ # Update system drivedb.h with the shipped version. >+ >+ einfo "The drivedb.h shipped with ${PF} appears to be" >+ einfo "newer than the system's existing drivedb.h." >+ einfo "Replacing existing ${sys_db_file} with" >+ einfo "the shipped drivedb.h". >+ cp -p "${shipped_db_file}" "${sys_db_path}/" || die >+ >+ else >+ # Shipped drivedb.h is no newer than system drivedb.h. >+ # Assume that the system drivedb.h is either the same as >+ # or a newer version than the shipped drivedb.h. >+ >+ einfo "The drivedb.h shipped with ${PF} appears to be" >+ einfo "no newer than the system's existing drivedb.h." >+ einfo "Preserving existing ${sys_db_file}." >+ fi > fi >+ >+ elif [[ ! -e "${sys_db_file}" ]]; then >+ # If the system has no existing drivedb.h, install the shipped >+ # drivedb.h. >+ >+ einfo "No existing ${sys_db_file} was found." >+ einfo "Installing the drivedb.h shipped with ${PF} to" >+ einfo "${sys_db_file}." >+ cp -p "${shipped_db_file}" "${sys_db_path}/" || die >+ >+ else >+ # The system has an existing drivedb.h, but it is not a >+ # regular file. That doesn't make any sense to us, so it's >+ # probably best to just leave it as we found it. >+ >+ ewarn "Existing ${sys_db_file} is not a regular file;" >+ ewarn "leaving it as-is." >+ fi >+ >+ einfo "" >+ einfo "The system's installed drivedb.h may be updated by running" >+ einfo "the following command as root:" >+ einfo "" >+ einfo " /usr/sbin/update-smart-drivedb" >+ if ! use update-drivedb ; then >+ einfo "" >+ einfo "However, please note that 'update-smart-drivedb' will not" >+ einfo "be available unless you re-emerge ${PN} with" >+ einfo "USE='update-drivedb'." > fi > fi > } >-- >2.26.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 683104
:
572452
|
684732
| 684816 |
766807