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
Nurlan
eepm
Commits
8d7ee232
Commit
8d7ee232
authored
Sep 04, 2021
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
introduce is_root and sudoepm (run epm under root)
parent
c970af23
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
epm-checksystem
bin/epm-checksystem
+1
-1
epm-sh-functions
bin/epm-sh-functions
+17
-7
No files found.
bin/epm-checksystem
View file @
8d7ee232
...
...
@@ -38,7 +38,7 @@ epm_checksystem_ALTLinux()
epm_checksystem
()
{
[
$EFFUID
=
"0"
]
&&
fatal
"Do not use checksystem under root"
is_root
&&
fatal
"Do not use checksystem under root"
case
$PMTYPE
in
homebrew
)
...
...
bin/epm-sh-functions
View file @
8d7ee232
...
...
@@ -109,7 +109,7 @@ showcmd()
if
[
-z
"
$quiet
"
]
;
then
set_boldcolor
$GREEN
local
PROMTSIG
=
"
\$
"
[
"
$EFFUID
"
=
0
]
&&
PROMTSIG
=
"#"
is_root
&&
PROMTSIG
=
"#"
echo
"
$PROMTSIG
$*
"
restore_color
fi
>
&2
...
...
@@ -257,7 +257,14 @@ clean_store_output()
epm
()
{
[
-n
"
$PROGNAME
"
]
||
fatal
"Can't use epm call from the piped script"
$PROGDIR
/
$PROGNAME
--inscript
$@
$PROGDIR
/
$PROGNAME
--inscript
"
$@
"
}
# run $SUDO epm, possible from side repo
sudoepm
()
{
[
-n
"
$PROGNAME
"
]
||
fatal
"Can't use epm call from the piped script"
sudorun
$PROGDIR
/
$PROGNAME
--inscript
"
$@
"
}
# Print error message and stop the program
...
...
@@ -313,10 +320,8 @@ set_sudo()
return
fi
EFFUID
=
$(
id
-u
)
# if we are root, do not need sudo
[
$EFFUID
=
"0"
]
&&
return
is_root
&&
return
# start error section
SUDO_TESTED
=
"1"
...
...
@@ -412,10 +417,15 @@ confirm_info()
}
is_root
()
{
local
EFFUID
=
"
$(
id
-u
)
"
[
"
$EFFUID
"
=
"0"
]
}
assure_root
()
{
set_sudo
[
"
$EFFUID
"
=
0
]
||
fatal
"run me only under root"
is_root
||
fatal
"run me only under root"
}
regexp_subst
()
...
...
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