Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav
eepm
Commits
edcc1437
Commit
edcc1437
authored
2 years ago
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
epm repo enable/disable: use sed_escape()
parent
2daba332
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
12 deletions
+4
-12
epm-repodisable
bin/epm-repodisable
+2
-6
epm-repoenable
bin/epm-repoenable
+2
-6
No files found.
bin/epm-repodisable
View file @
edcc1437
...
...
@@ -22,10 +22,6 @@ load_helper epm-sh-altlinux
alt_LISTS
=
'/etc/apt/sources.list /etc/apt/sources.list.d/*.list'
sed_quote
()
{
echo
"
$*
"
|
sed
-e
's|\(\[\)|\\\1|g'
-e
's|\(\]\)|\\\1|g'
-e
's|\(\.\)|\\\1|g'
}
__epm_repodisable_alt
()
{
...
...
@@ -34,12 +30,12 @@ __epm_repodisable_alt()
if
rhas
"
$1
"
"
\^
rpm"
;
then
rl
=
"
$(
echo
"
$1
"
|
sed
-e
's|\^||'
)
"
else
rl
=
"
$(
(
epm
--quiet
repolist
)
2>/dev/null | grep -
E "
$(
sed_quote
"
$1
"
)
"
)"
rl
=
"
$(
(
epm
--quiet
repolist
)
2>/dev/null | grep -
F "
$1
" | head -n1
)"
[
-z
"
$rl
"
]
&&
warning
"Can't find '
$1
' entries in the repos (see '# epm repolist' output)"
&&
return
1
fi
echo
"
$rl
"
|
while
read
rp
;
do
[
-n
"
$dryrun
"
]
&&
echo
"will comment
$rp
"
&&
continue
sed
-i
-e
"s|^
\(
$(
sed_
quot
e
"
$rl
"
)
\)
|#
\1
|"
$alt_LISTS
sed
-i
-e
"s|^
\(
$(
sed_
escap
e
"
$rl
"
)
\)
|#
\1
|"
$alt_LISTS
done
}
...
...
This diff is collapsed.
Click to expand it.
bin/epm-repoenable
View file @
edcc1437
...
...
@@ -22,10 +22,6 @@ load_helper epm-sh-altlinux
alt_LISTS
=
'/etc/apt/sources.list /etc/apt/sources.list.d/*.list'
sed_quote
()
{
echo
"
$*
"
|
sed
-e
's|\(\[\)|\\\1|g'
-e
's|\(\]\)|\\\1|g'
-e
's|\(\.\)|\\\1|g'
}
__epm_repoenable_alt
()
{
...
...
@@ -34,12 +30,12 @@ __epm_repoenable_alt()
if
rhas
"
$1
"
"
\^
rpm"
;
then
rl
=
"
$(
echo
"
$1
"
|
sed
-e
's|\^||'
)
"
else
rl
=
"
$(
(
epm
--quiet
--all
repolist
)
2>/dev/null | grep -E "
$(
sed_quote
"
$1
"
)
"
)"
rl
=
"
$(
epm
--quiet
--all
repolist 2>/dev/null |
grep
-F
"
$1
"
|
head
-n1
|
sed
-e
's|[[:space:]]*#[[:space:]]*||'
)
"
[
-z
"
$rl
"
]
&&
warning
"Can't find commented '
$1
' in the repos (see '# epm repolist' output)"
&&
return
1
fi
echo
"
$rl
"
|
while
read
rp
;
do
[
-n
"
$dryrun
"
]
&&
echo
"will uncomment
$rp
"
&&
continue
sed
-i
-e
"s|^[[:space:]]*#[[:space:]]*
\(
$(
sed_
quot
e
"
$rl
"
)
\)
|
\1
|"
$alt_LISTS
sed
-i
-e
"s|^[[:space:]]*#[[:space:]]*
\(
$(
sed_
escap
e
"
$rl
"
)
\)
|
\1
|"
$alt_LISTS
done
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment