diff options
author | Francesco Riosa <vivo@gentoo.org> | 2006-01-08 23:41:42 +0000 |
---|---|---|
committer | Francesco Riosa <vivo@gentoo.org> | 2006-01-08 23:41:42 +0000 |
commit | e88a8f980eb54da456bcc9ddd82a11a684ff8808 (patch) | |
tree | a5ff961f56ac358c42c185db097a0c6849089787 /app-admin | |
parent | ~amd64 - bug #104220 (diff) | |
download | historical-e88a8f980eb54da456bcc9ddd82a11a684ff8808.tar.gz historical-e88a8f980eb54da456bcc9ddd82a11a684ff8808.tar.bz2 historical-e88a8f980eb54da456bcc9ddd82a11a684ff8808.zip |
Added "remove" action to remove simlinks
Package-Manager: portage-2.0.53
Diffstat (limited to 'app-admin')
-rw-r--r-- | app-admin/eselect-mysql/ChangeLog | 7 | ||||
-rw-r--r-- | app-admin/eselect-mysql/Manifest | 4 | ||||
-rw-r--r-- | app-admin/eselect-mysql/files/mysql.eselect | 62 |
3 files changed, 55 insertions, 18 deletions
diff --git a/app-admin/eselect-mysql/ChangeLog b/app-admin/eselect-mysql/ChangeLog index fe71cf9776f9..582fe022b934 100644 --- a/app-admin/eselect-mysql/ChangeLog +++ b/app-admin/eselect-mysql/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for app-admin/eselect-mysql # Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-mysql/ChangeLog,v 1.3 2006/01/07 22:40:38 vivo Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-mysql/ChangeLog,v 1.4 2006/01/08 23:41:42 vivo Exp $ + + 08 Jan 2006; Francesco Riosa <vivo@gentoo.org> files/mysql.eselect: + Added "remove" action to remove simlinks + removed need to check for both plain and .gz files for manpages due to a move + as a consequence of a mysql eclass change. 07 Jan 2006; Francesco Riosa <vivo@gentoo.org> files/mysql.eselect: Many changes after chatting with kugelfang in irc diff --git a/app-admin/eselect-mysql/Manifest b/app-admin/eselect-mysql/Manifest index f204b6fd5624..8d6a0f241b01 100644 --- a/app-admin/eselect-mysql/Manifest +++ b/app-admin/eselect-mysql/Manifest @@ -1,5 +1,5 @@ -MD5 9965639182f7212e56690bcb7825afd0 ChangeLog 758 +MD5 292cd87be527af4de5f87b1e2b5a6af1 ChangeLog 997 MD5 c069ec9f84ebf9fab35f5d0ccdcc8943 eselect-mysql-1.0.0.ebuild 614 MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-eselect-mysql-1.0.0 0 -MD5 ddfd13f54e4a72d3036be625cbd7ccce files/mysql.eselect 5028 +MD5 80f375dbb99b7608ce24e40919ead50a files/mysql.eselect 5689 MD5 fa97fe3e6f213f79ccf7ffbd53838095 metadata.xml 338 diff --git a/app-admin/eselect-mysql/files/mysql.eselect b/app-admin/eselect-mysql/files/mysql.eselect index c258c220ecad..4ba4a8d4e5ba 100644 --- a/app-admin/eselect-mysql/files/mysql.eselect +++ b/app-admin/eselect-mysql/files/mysql.eselect @@ -1,13 +1,14 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id: mysql.eselect,v 1.3 2006/01/07 22:40:38 vivo Exp $ +# $Id: mysql.eselect,v 1.4 2006/01/08 23:41:42 vivo Exp $ DESCRIPTION="Manage the /usr/lib/*mysql* links" MAINTAINER="vivo@gentoo.org" -SVN_DATE='$Date: 2006/01/07 22:40:38 $' +SVN_DATE='$Date: 2006/01/08 23:41:42 $' VERSION=$(svn_date_to_version "${SVN_DATE}" ) MYSQL_SYMLINK_CHECKDIR="${ROOT}/usr/sbin" ERR_NOT_FOUND="(not-found)" +# "unset" is grepped by the MySQL ebuild so don't touch it ERR_UNSET="(unset)" # return a human oriented version @@ -33,7 +34,7 @@ function version4bash() { # Return the versions currently installed find_versions() { - local versions lis + local versions list # "eselect mysql set 1" will always set the best version list=${MYSQL_SYMLINK_CHECKDIR}/mysqld-* [[ ${list##/} == mysqld-* ]] && return @@ -56,8 +57,7 @@ check_symlink() { [[ -z ${filename} ]] || [[ -z ${version} ]] && return 1 # check link source - [[ -f ${filename} ]] || [[ -f "${filename}.gz" ]] \ - || [[ -d ${filename} ]] || ret=$(( ${ret} + 1 )) + [[ -f ${filename} ]] || [[ -d ${filename} ]] || ret=$(( ${ret} + 1 )) # check link targe # not checking for directory (want to keep "/etc/mysql") @@ -108,7 +108,7 @@ set_current_version() { local version=${1} is_number "${version}" || die -q "No usable version: ${version}" local CWD=$(pwd) - local lastdir dir linkname linkname2 + local lastdir dir linkname local list=$(< $ROOT/var/lib/eselect/mysql/mysql-${version}.filelist ) # perform a check on the entire file lis @@ -135,15 +135,29 @@ set_current_version() { lastdir="${dir}" fi linkname="$(basename "${filename}")" - for linkname2 in "${linkname}" "${linkname}.gz" ; do - if [[ -a "${linkname2}" ]] ; then - # rm needed for directory - rm -f "${linkname/"-${version}"/}" &> /dev/null - ln -sf "${linkname2}" "${linkname2/"-${version}"/}" - [[ ! -L "${linkname2/"-${version}"/}" ]] \ - && write_warning_msg "FAILED: cd \"${dir}\" && ln -sf \"${linkname2}\" \"${linkname2/"-${version}"/}\"" - fi - done + if [[ -a "${linkname}" ]] ; then + # rm needed for directory + rm -f "${linkname/"-${version}"/}" &> /dev/null + ln -sf "${linkname}" "${linkname/"-${version}"/}" + [[ ! -L "${linkname/"-${version}"/}" ]] \ + && write_warning_msg "FAILED: cd \"${dir}\" && ln -sf \"${linkname}\" \"${linkname/"-${version}"/}\"" + fi + done + + cd "${CWD}" +} + +remove_current_version() { + + local version=${1} + is_number "${version}" || die -q "No usable version: ${version}" + local CWD=$(pwd) + local lastdir dir linkname + local list=$(< $ROOT/var/lib/eselect/mysql/mysql-${version}.filelist ) + + for filename in $list ; do + linkname="${ROOT}/${filename/"-${version}"/}" + [[ -L "${linkname}" ]] && rm -f "${linkname}" done cd "${CWD}" @@ -204,4 +218,22 @@ do_set() { set_current_version "$(version4bash "${version}")" } +### remove action ### + +describe_remove() { + echo "Remove symlinks of the default server" +} + +do_remove() { + + local version=$(readlink "${MYSQL_SYMLINK_CHECKDIR}/mysqld") + version=$(version4human "${version##*-}") + + if [[ -z "${version}" ]] ; then + die -q "No symlinks found" + fi + + remove_current_version "$(version4bash "${version}")" +} + # vim: set ft=eselect : |