2020-05-03 20:38:43 +02:00
|
|
|
#!/bin/sh
|
2020-12-29 21:21:17 +01:00
|
|
|
|
|
|
|
# This file is part of scripts.
|
|
|
|
|
|
|
|
# scripts is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
2021-03-29 13:02:30 +02:00
|
|
|
# the Free Software Foundation, version 3.
|
2020-12-29 21:21:17 +01:00
|
|
|
|
|
|
|
# scripts is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with scripts. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
# Original author: xenhat (me@xenh.at)
|
|
|
|
# Copyright (c) 2020, src_prepare group
|
|
|
|
# Licensed under the GNU GPL v3 License
|
|
|
|
|
2020-05-03 20:38:43 +02:00
|
|
|
# Description: A script to remove explicit version match in portage configuration files.
|
|
|
|
# Developed for /etc/portage/package.accept_keywords, may or may not
|
|
|
|
# not work onther files.
|
2020-12-29 21:21:17 +01:00
|
|
|
|
|
|
|
|
2020-05-03 20:43:27 +02:00
|
|
|
if [ -z "$1" ]; then
|
2021-06-04 10:19:26 +02:00
|
|
|
printf "%s\n" "Must specify a file to modify..."
|
2020-05-03 20:38:43 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
regex='^=?(\S+)(?:-[[:digit:]]+\S*)(\s)(\S+)$'
|
|
|
|
sub='\1\2\3'
|
|
|
|
perl -pe "s;$regex;$sub;gm" -i "${1}"
|