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
c4033fce
Commit
c4033fce
authored
Nov 25, 2020
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
separate code for play command
parent
89d33e80
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
40 deletions
+119
-40
epm
bin/epm
+1
-1
epm-play
bin/epm-play
+116
-0
epm-prescription
bin/epm-prescription
+2
-39
No files found.
bin/epm
View file @
c4033fce
...
@@ -333,7 +333,7 @@ check_command()
...
@@ -333,7 +333,7 @@ check_command()
epm_cmd
=
prescription
epm_cmd
=
prescription
;;
;;
play
)
# HELPCMD: install the application from the official site (run without args to get list)
play
)
# HELPCMD: install the application from the official site (run without args to get list)
epm_cmd
=
p
rescription
epm_cmd
=
p
lay
;;
;;
-V
|
checkpkg|integrity
)
# HELPCMD: check package file integrity (checksum)
-V
|
checkpkg|integrity
)
# HELPCMD: check package file integrity (checksum)
epm_cmd
=
checkpkg
epm_cmd
=
checkpkg
...
...
bin/epm-play
0 → 100644
View file @
c4033fce
#!/bin/sh
#
# Copyright (C) 2015, 2017, 2019, 2020 Etersoft
# Copyright (C) 2015, 2017, 2019, 2020 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# TODO
epm_vardir
=
/var/lib/eepm
__save_installed_app
()
{
[
-d
"
$epm_vardir
"
]
||
return
0
estrlist list
"
$@
"
|
$SUDO
tee
$epm_vardir
/installed-app
>
/dev/null
}
__remove_installed_app
()
{
[
-d
"
$epm_vardir
"
]
||
return
0
local
i
for
i
in
$*
;
do
$SUDO
sed
-i
"/^
$i$/
d"
$epm_vardir
/installed-app
done
return
0
}
__check_installed_app
()
{
[
-s
$epm_vardir
/installed-app
]
||
return
1
grep
-q
--
"^
$1
\$
"
$epm_vardir
/installed-app
}
__list_installed_app
()
{
cat
$epm_vardir
/installed-app 2>/dev/null
}
__epm_play_run
()
{
local
script
=
"
$psdir
/
$1
.sh"
shift
local
option
=
"
$1
"
if
[
!
-x
"
$script
"
]
;
then
fatal
"Can't find play script
$script
."
fi
# allow use EGET in the scripts
__set_EGET
# also we will have DISTRVENDOR there
export
PATH
=
$PROGDIR
:
$PATH
#info "Running $($script --description 2>/dev/null) ..."
docmd
$script
$option
}
epm_play
()
{
# TODO: change to play.d
local
psdir
=
"
$CONFIGDIR
/prescription.d"
if
[
"
$1
"
=
"-h"
]
||
[
"
$1
"
=
"--help"
]
;
then
cat
<<
EOF
Options:
APP - install APP
--remove APP - remove APP
--list - list all installed apps
--list-all - list all available apps
EOF
exit
fi
if
[
"
$1
"
=
"--remove"
]
;
then
shift
#__check_installed_app "$1" || fatal "$1 is not installed"
__epm_play_run
$1
--remove
__remove_installed_app
"
$@
"
exit
fi
if
[
"
$1
"
=
"--list"
]
||
[
"
$1
"
=
"--installed"
]
;
then
shift
echo
"Installed:"
local
i
for
i
in
$(
__list_installed_app
)
;
do
printf
" %-20s - %s
\n
"
"
$i
"
"
$(
$psdir
/
$i
.sh
--description
2>/dev/null
)
"
done
exit
fi
if
[
"
$1
"
==
"--list-all"
]
||
[
-z
"
$*
"
]
;
then
echo
"Run with a name of a play script to run:"
for
i
in
$psdir
/
*
.sh
;
do
printf
" %-20s - %s
\n
"
"
$(
basename
$i
.sh
)
"
"
$(
$i
--description
2>/dev/null
)
"
done
echo
echo
"run epm play --list to list installed only or --remove to remove one"
exit
fi
__check_installed_app
"
$1
"
&&
info
"
$1
is already installed"
&&
exit
1
__epm_play_run
"
$1
"
--run
&&
__save_installed_app
"
$1
"
}
bin/epm-prescription
View file @
c4033fce
...
@@ -20,33 +20,6 @@
...
@@ -20,33 +20,6 @@
# TODO
# TODO
epm_vardir
=
/var/lib/eepm
epm_vardir
=
/var/lib/eepm
__save_installed_app
()
{
[
-d
"
$epm_vardir
"
]
||
return
0
estrlist list
"
$@
"
|
$SUDO
tee
$epm_vardir
/installed-app
>
/dev/null
}
__remove_installed_app
()
{
[
-d
"
$epm_vardir
"
]
||
return
0
local
i
for
i
in
$*
;
do
$SUDO
sed
-i
"/^
$i$/
d"
$epm_vardir
/installed-app
done
return
0
}
__check_installed_app
()
{
[
-s
$epm_vardir
/installed-app
]
||
return
1
grep
-q
--
"^
$1
\$
"
$epm_vardir
/installed-app
}
__list_installed_app
()
{
cat
$epm_vardir
/installed-app 2>/dev/null
}
__epm_prescription_run
()
__epm_prescription_run
()
{
{
...
@@ -76,21 +49,12 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
...
@@ -76,21 +49,12 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
cat
<<
EOF
cat
<<
EOF
Options:
Options:
APP - install APP
APP - install APP
--remove APP - remove APP
--list - list all installed apps
--list - list all installed apps
--list-all - list all available apps
--list-all - list all available apps
EOF
EOF
exit
exit
fi
fi
if
[
"
$1
"
=
"--remove"
]
;
then
shift
#__check_installed_app "$1" || fatal "$1 is not installed"
__epm_prescription_run
$1
--remove
__remove_installed_app
"
$@
"
exit
fi
if
[
"
$1
"
=
"--list"
]
||
[
"
$1
"
=
"--installed"
]
;
then
if
[
"
$1
"
=
"--list"
]
||
[
"
$1
"
=
"--installed"
]
;
then
shift
shift
echo
"Installed:"
echo
"Installed:"
...
@@ -107,10 +71,9 @@ if [ "$1" == "--list-all" ] || [ -z "$*" ] ; then
...
@@ -107,10 +71,9 @@ if [ "$1" == "--list-all" ] || [ -z "$*" ] ; then
printf
" %-20s - %s
\n
"
"
$(
basename
$i
.sh
)
"
"
$(
$i
--description
2>/dev/null
)
"
printf
" %-20s - %s
\n
"
"
$(
basename
$i
.sh
)
"
"
$(
$i
--description
2>/dev/null
)
"
done
done
echo
echo
echo
"run epm p
lay --list to list installed only or --remove to remove one
"
echo
"run epm p
rescription --list to list installed only
"
exit
exit
fi
fi
__check_installed_app
"
$1
"
&&
info
"
$1
is already installed"
&&
exit
1
__epm_prescription_run
"
$1
"
--run
__epm_prescription_run
"
$1
"
--run
&&
__save_installed_app
"
$1
"
}
}
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