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
etersoft
eepm
Commits
de087e1a
Commit
de087e1a
authored
Nov 29, 2018
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit pack in one file
parent
1b24e1df
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
198 additions
and
145 deletions
+198
-145
epm.sh
packed/epm.sh
+139
-85
serv.sh
packed/serv.sh
+59
-60
No files found.
packed/epm.sh
View file @
de087e1a
...
@@ -45,7 +45,8 @@ load_helper()
...
@@ -45,7 +45,8 @@ load_helper()
inputisatty
()
inputisatty
()
{
{
# check stdin
# check stdin
tty
-s
2>/dev/null
#tty -s 2>/dev/null
test
-t
0
}
}
isatty
()
isatty
()
...
@@ -491,14 +492,14 @@ case $DISTRNAME in
...
@@ -491,14 +492,14 @@ case $DISTRNAME in
ArchLinux
)
ArchLinux
)
CMD
=
"pacman"
CMD
=
"pacman"
;;
;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux
)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux
|Amzn
)
CMD
=
"yum-rpm"
CMD
=
"yum-rpm"
which dnf 2>/dev/null
>
/dev/null
&&
test
-d
/var/lib/dnf/yumdb
&&
CMD
=
dnf-rpm
which dnf 2>/dev/null
>
/dev/null
&&
test
-d
/var/lib/dnf/yumdb
&&
CMD
=
dnf-rpm
;;
;;
Slackware
)
Slackware
)
CMD
=
"slackpkg"
CMD
=
"slackpkg"
;;
;;
SUSE|SLED|SLES
|Tumbleweed
)
SUSE|SLED|SLES
)
CMD
=
"zypper-rpm"
CMD
=
"zypper-rpm"
;;
;;
ForesightLinux|rPathLinux
)
ForesightLinux|rPathLinux
)
...
@@ -510,8 +511,8 @@ case $DISTRNAME in
...
@@ -510,8 +511,8 @@ case $DISTRNAME in
MacOS
)
MacOS
)
CMD
=
"homebrew"
CMD
=
"homebrew"
;;
;;
OpenW
RT
)
OpenW
rt
)
CMD
=
"
i
pkg"
CMD
=
"
o
pkg"
;;
;;
GNU/Linux/Guix
)
GNU/Linux/Guix
)
CMD
=
"guix"
CMD
=
"guix"
...
@@ -1149,6 +1150,13 @@ case $PMTYPE in
...
@@ -1149,6 +1150,13 @@ case $PMTYPE in
fi
fi
sudocmd xbps-remove
-O
sudocmd xbps-remove
-O
;;
;;
opkg
)
if
[
-n
"
$dryrun
"
]
;
then
sudocmd opkg
--noaction
--autoremove
else
sudocmd opkg
--autoremove
fi
;;
*
)
*
)
fatal
"Have no suitable command for
$PMTYPE
"
fatal
"Have no suitable command for
$PMTYPE
"
;;
;;
...
@@ -1965,6 +1973,9 @@ epm_download()
...
@@ -1965,6 +1973,9 @@ epm_download()
tce
)
tce
)
sudocmd tce-load
-w
$pkg_filenames
sudocmd tce-load
-w
$pkg_filenames
;;
;;
opkg
)
docmd opkg
$pkg_filenames
;;
*
)
*
)
fatal
"Have no suitable command for
$PMTYPE
"
fatal
"Have no suitable command for
$PMTYPE
"
;;
;;
...
@@ -2137,6 +2148,9 @@ __epm_filelist_name()
...
@@ -2137,6 +2148,9 @@ __epm_filelist_name()
pkgng
)
pkgng
)
CMD
=
"pkg info -l"
CMD
=
"pkg info -l"
;;
;;
opkg
)
CMD
=
"opkg files"
;;
xbps
)
xbps
)
CMD
=
"xbps-query -f"
CMD
=
"xbps-query -f"
;;
;;
...
@@ -2265,8 +2279,8 @@ case $PMTYPE in
...
@@ -2265,8 +2279,8 @@ case $PMTYPE in
slackpkg
)
slackpkg
)
docmd /usr/sbin/slackpkg info
$pkg_names
docmd /usr/sbin/slackpkg info
$pkg_names
;;
;;
i
pkg
)
o
pkg
)
docmd
i
pkg info
$pkg_names
docmd
o
pkg info
$pkg_names
;;
;;
pkgng
)
pkgng
)
docmd pkg info
$pkg_names
docmd pkg info
$pkg_names
...
@@ -2453,9 +2467,9 @@ epm_install_names()
...
@@ -2453,9 +2467,9 @@ epm_install_names()
# FIXME: sudo and quote
# FIXME: sudo and quote
SUDO
=
''
__separate_sudocmd
"brew install"
"brew upgrade"
"
$@
"
SUDO
=
''
__separate_sudocmd
"brew install"
"brew upgrade"
"
$@
"
return
;;
return
;;
i
pkg
)
o
pkg
)
[
-n
"
$force
"
]
&&
force
=
-force-depends
[
-n
"
$force
"
]
&&
force
=
-force-depends
sudocmd
i
pkg
$force
install
$@
sudocmd
o
pkg
$force
install
$@
return
;;
return
;;
nix
)
nix
)
__separate_sudocmd
"nix-env --install"
"nix-env --upgrade"
"
$@
"
__separate_sudocmd
"nix-env --install"
"nix-env --upgrade"
"
$@
"
...
@@ -2531,8 +2545,8 @@ epm_ni_install_names()
...
@@ -2531,8 +2545,8 @@ epm_ni_install_names()
chocolatey
)
chocolatey
)
docmd chocolatey
install
$@
docmd chocolatey
install
$@
return
;;
return
;;
i
pkg
)
o
pkg
)
sudocmd
i
pkg
-force-defaults
install
$@
sudocmd
o
pkg
-force-defaults
install
$@
return
;;
return
;;
nix
)
nix
)
sudocmd nix-env
--install
$@
sudocmd nix-env
--install
$@
...
@@ -2745,8 +2759,8 @@ epm_print_install_command()
...
@@ -2745,8 +2759,8 @@ epm_print_install_command()
npackd
)
npackd
)
echo
"npackdcl add --package=
$*
"
echo
"npackdcl add --package=
$*
"
;;
;;
i
pkg
)
o
pkg
)
echo
"
i
pkg install
$*
"
echo
"
o
pkg install
$*
"
;;
;;
android
)
android
)
echo
"pm install
$*
"
echo
"pm install
$*
"
...
@@ -3160,8 +3174,8 @@ case $PMTYPE in
...
@@ -3160,8 +3174,8 @@ case $PMTYPE in
homebrew
)
homebrew
)
docmd brew list | xargs
-n1
echo
docmd brew list | xargs
-n1
echo
;;
;;
i
pkg
)
o
pkg
)
CMD
=
"
ipkg list
"
CMD
=
"
opkg list-installed
"
;;
;;
apk
)
apk
)
CMD
=
"apk info"
CMD
=
"apk info"
...
@@ -3259,7 +3273,7 @@ print_binpkgfilelist()
...
@@ -3259,7 +3273,7 @@ print_binpkgfilelist()
| xargs
-n1
-I
"{}"
echo
-n
"
$PKGDIR
/{} "
| xargs
-n1
-I
"{}"
echo
-n
"
$PKGDIR
/{} "
}
}
PKGNAMEMASK
=
"
\(
.*
\)
-
\(
[0-9].*
\)
-
\(
.*[0-9].*
\)
"
PKGNAMEMASK
=
"
\(
.*
\)
-
\(
[0-9].*
\)
-
\(
.*[0-9].*
\)
\.\(
.*
\)\.\(
.*
\)
"
print_name
()
print_name
()
{
{
...
@@ -3276,6 +3290,11 @@ print_release()
...
@@ -3276,6 +3290,11 @@ print_release()
echo
"
$1
"
| xargs
-n1
echo
|
sed
-e
"s|
$PKGNAMEMASK
|
\3
|g"
echo
"
$1
"
| xargs
-n1
echo
|
sed
-e
"s|
$PKGNAMEMASK
|
\3
|g"
}
}
print_version_release
()
{
echo
"
$1
"
| xargs
-n1
echo
|
sed
-e
"s|
$PKGNAMEMASK
|
\2
-
\3
|g"
}
print_pkgname
()
print_pkgname
()
{
{
local
i
local
i
...
@@ -3336,6 +3355,7 @@ cat <<EOF
...
@@ -3336,6 +3355,7 @@ cat <<EOF
epm print name [from filename|for package] NN print only name of package name or package file
epm print name [from filename|for package] NN print only name of package name or package file
epm print version [from filename|for package] NN print only version of package name or package file
epm print version [from filename|for package] NN print only version of package name or package file
epm print release [from filename|for package] NN print only release of package name or package file
epm print release [from filename|for package] NN print only release of package name or package file
epm print version-release [from filename|for package] NN print only release-release of package name or package file
epm print field FF for package NN print field of the package
epm print field FF for package NN print field of the package
epm print pkgname from filename NN print package name for the package file
epm print pkgname from filename NN print package name for the package file
epm print srcname from filename NN print source name for the package file
epm print srcname from filename NN print source name for the package file
...
@@ -3375,6 +3395,16 @@ EOF
...
@@ -3375,6 +3395,16 @@ EOF
print_release
"
$@
"
print_release
"
$@
"
fi
fi
;;
;;
"version-release"
)
[
-n
"
$1
"
]
||
fatal
"Arg is missed"
if
[
-n
"
$FNFLAG
"
]
;
then
print_version_release
"
$(
print_pkgname
"
$@
"
)
"
elif
[
-n
"
$PKFLAG
"
]
;
then
echo
"
$(
query_package_field
"version"
"
$@
"
)
-
$(
query_package_field
"release"
"
$@
"
)
"
else
print_version_release
"
$@
"
fi
;;
"field"
)
"field"
)
[
-n
"
$1
"
]
||
fatal
"Arg is missed"
[
-n
"
$1
"
]
||
fatal
"Arg is missed"
local
FIELD
=
"
$1
"
local
FIELD
=
"
$1
"
...
@@ -3556,6 +3586,7 @@ __print_with_arch_suffix()
...
@@ -3556,6 +3586,7 @@ __print_with_arch_suffix()
{
{
local
pkg
=
"
$1
"
local
pkg
=
"
$1
"
local
suffix
=
"
$2
"
local
suffix
=
"
$2
"
[
-n
"
$pkg
"
]
||
return
1
# do not change if some suffix already exists
# do not change if some suffix already exists
echo
"
$pkg
"
|
grep
-q
"(x86-32)$"
&&
echo
"
$pkg
"
|
sed
-e
"s|(x86-32)
$|
.i686|"
&&
return
1
echo
"
$pkg
"
|
grep
-q
"(x86-32)$"
&&
echo
"
$pkg
"
|
sed
-e
"s|(x86-32)
$|
.i686|"
&&
return
1
echo
"
$pkg
"
|
grep
"
\.
x86_64$"
&&
return
1
echo
"
$pkg
"
|
grep
"
\.
x86_64$"
&&
return
1
...
@@ -3947,8 +3978,8 @@ __do_query()
...
@@ -3947,8 +3978,8 @@ __do_query()
docmd
grep
-R
--
"
$(
echo
$@
|
sed
-e
's|^/\+||g'
)
"
/var/log/packages |
sed
-e
"s|/var/log/packages/||g"
docmd
grep
-R
--
"
$(
echo
$@
|
sed
-e
's|^/\+||g'
)
"
/var/log/packages |
sed
-e
"s|/var/log/packages/||g"
return
return
;;
;;
i
pkg
)
o
pkg
)
CMD
=
"
ipkg files
"
CMD
=
"
opkg search
"
;;
;;
xbps
)
xbps
)
# FIXME: maybe it is search file?
# FIXME: maybe it is search file?
...
@@ -4068,6 +4099,9 @@ epm_reinstall_names()
...
@@ -4068,6 +4099,9 @@ epm_reinstall_names()
pkgng
)
pkgng
)
sudocmd pkg
install
-f
$@
sudocmd pkg
install
-f
$@
return
;;
return
;;
opkg
)
sudocmd opkg
--force-reinstall
install
$@
return
;;
slackpkg
)
slackpkg
)
sudocmd_foreach
"/usr/sbin/slackpkg reinstall"
$@
sudocmd_foreach
"/usr/sbin/slackpkg reinstall"
$@
return
;;
return
;;
...
@@ -4262,7 +4296,9 @@ __update_to_the_distro()
...
@@ -4262,7 +4296,9 @@ __update_to_the_distro()
;;
;;
Sisyphus
)
Sisyphus
)
docmd epm update
||
fatal
docmd epm update
||
fatal
docmd epm
install
librpm7 librpm rpm apt
"
$(
get_fix_release_pkg
--force
"
$TO
"
)
"
||
fatal
"Check an error and run again"
local
ADDPKG
ADDPKG
=
$(
epm
-q
--short
make-initrd
)
docmd epm
install
librpm7 librpm rpm apt
$ADDPKG
"
$(
get_fix_release_pkg
--force
"
$TO
"
)
"
ConsoleKit2-
||
fatal
"Check an error and run again"
#docmd apt-get upgrade || fatal "Check an error and run epm release-upgrade or just epm upgrade again"
#docmd apt-get upgrade || fatal "Check an error and run epm release-upgrade or just epm upgrade again"
docmd epm upgrade
||
fatal
"Check an error and run epm release-upgrade or just epm upgrade again"
docmd epm upgrade
||
fatal
"Check an error and run epm release-upgrade or just epm upgrade again"
;;
;;
...
@@ -4558,9 +4594,9 @@ epm_remove_names()
...
@@ -4558,9 +4594,9 @@ epm_remove_names()
xbps
)
xbps
)
sudocmd xbps remove
-R
$@
sudocmd xbps remove
-R
$@
return
;;
return
;;
i
pkg
)
o
pkg
)
# shellcheck disable=SC2046
# shellcheck disable=SC2046
sudocmd
i
pkg
$(
subst_option force
-force-depends
)
remove
$@
sudocmd
o
pkg
$(
subst_option force
-force-depends
)
remove
$@
return
;;
return
;;
*
)
*
)
fatal
"Have no suitable command for
$PMTYPE
"
fatal
"Have no suitable command for
$PMTYPE
"
...
@@ -4603,8 +4639,8 @@ epm_remove_nonint()
...
@@ -4603,8 +4639,8 @@ epm_remove_nonint()
pkgng
)
pkgng
)
sudocmd pkg delete
-y
-R
$@
sudocmd pkg delete
-y
-R
$@
return
;;
return
;;
i
pkg
)
o
pkg
)
sudocmd
i
pkg
-force-defaults
remove
$@
sudocmd
o
pkg
-force-defaults
remove
$@
return
;;
return
;;
xbps
)
xbps
)
sudocmd xbps remove
-y
$@
sudocmd xbps remove
-y
$@
...
@@ -4637,8 +4673,8 @@ epm_print_remove_command()
...
@@ -4637,8 +4673,8 @@ epm_print_remove_command()
slackpkg
)
slackpkg
)
echo
"/sbin/removepkg
$*
"
echo
"/sbin/removepkg
$*
"
;;
;;
i
pkg
)
o
pkg
)
echo
"
i
pkg remove
$*
"
echo
"
o
pkg remove
$*
"
;;
;;
aptcyg
)
aptcyg
)
echo
"apt-cyg remove
$*
"
echo
"apt-cyg remove
$*
"
...
@@ -5312,6 +5348,9 @@ case $PMTYPE in
...
@@ -5312,6 +5348,9 @@ case $PMTYPE in
#CMD="pkg rquery '%dn-%dv'"
#CMD="pkg rquery '%dn-%dv'"
CMD
=
"pkg info -d"
CMD
=
"pkg info -d"
;;
;;
opkg
)
CMD
=
"opkg depends"
;;
xbps
)
xbps
)
CMD
=
"xbps-query -x"
CMD
=
"xbps-query -x"
;;
;;
...
@@ -5413,6 +5452,9 @@ case $PMTYPE in
...
@@ -5413,6 +5452,9 @@ case $PMTYPE in
return
return
fi
fi
;;
;;
opkg
)
CMD
=
"opkg find"
;;
homebrew
)
homebrew
)
CMD
=
"brew search"
CMD
=
"brew search"
;;
;;
...
@@ -5586,8 +5628,8 @@ case $PMTYPE in
...
@@ -5586,8 +5628,8 @@ case $PMTYPE in
slackpkg
)
slackpkg
)
CMD
=
"/usr/sbin/slackpkg file-search"
CMD
=
"/usr/sbin/slackpkg file-search"
;;
;;
i
pkg
)
o
pkg
)
CMD
=
"
ipkg
search"
CMD
=
"
opkg -A
search"
;;
;;
xbps
)
xbps
)
CMD
=
"xbps-query -Ro"
CMD
=
"xbps-query -Ro"
...
@@ -5859,6 +5901,9 @@ EOF
...
@@ -5859,6 +5901,9 @@ EOF
break
break
done
done
return
$res
;;
return
$res
;;
opkg
)
docmd
--noaction
install
$filenames
return
$res
;;
pacman
)
pacman
)
LC_ALL
=
C store_output sudocmd pacman
-v
-S
$filenames
<<
EOF
LC_ALL
=
C store_output sudocmd pacman
-v
-S
$filenames
<<
EOF
no
no
...
@@ -6101,8 +6146,8 @@ case $PMTYPE in
...
@@ -6101,8 +6146,8 @@ case $PMTYPE in
homebrew
)
homebrew
)
docmd brew update
docmd brew update
;;
;;
i
pkg
)
o
pkg
)
sudocmd
i
pkg update
sudocmd
o
pkg update
;;
;;
apk
)
apk
)
sudocmd apk update
sudocmd apk update
...
@@ -6193,8 +6238,8 @@ epm_upgrade()
...
@@ -6193,8 +6238,8 @@ epm_upgrade()
docmd
"brew upgrade
$(
brew outdated
)
"
docmd
"brew upgrade
$(
brew outdated
)
"
return
return
;;
;;
i
pkg
)
o
pkg
)
CMD
=
"
i
pkg upgrade"
CMD
=
"
o
pkg upgrade"
;;
;;
slackpkg
)
slackpkg
)
CMD
=
"/usr/sbin/slackpkg upgrade-all"
CMD
=
"/usr/sbin/slackpkg upgrade-all"
...
@@ -6247,6 +6292,11 @@ epm_whatdepends()
...
@@ -6247,6 +6292,11 @@ epm_whatdepends()
case
$PMTYPE
in
case
$PMTYPE
in
apt-rpm
)
apt-rpm
)
if
[
-n
"
$short
"
]
;
then
showcmd apt-cache whatdepends
$pkg
a
=
apt-cache whatdepends
$pkg
|
grep
"^ [^ ]"
|
sed
-e
"s|[0-9]*:||"
|
grep
-E
-v
"(i586-|-debuginfo)"
return
fi
CMD
=
"apt-cache whatdepends"
CMD
=
"apt-cache whatdepends"
;;
;;
apt-dpkg|aptitude-dpkg
)
apt-dpkg|aptitude-dpkg
)
...
@@ -6275,6 +6325,9 @@ case $PMTYPE in
...
@@ -6275,6 +6325,9 @@ case $PMTYPE in
aptcyg
)
aptcyg
)
CMD
=
"apt-cyg rdepends"
CMD
=
"apt-cyg rdepends"
;;
;;
opkg
)
CMD
=
"opkg whatdepends"
;;
xbps
)
xbps
)
CMD
=
"xbps-query -X"
CMD
=
"xbps-query -X"
;;
;;
...
@@ -6317,6 +6370,9 @@ case $PMTYPE in
...
@@ -6317,6 +6370,9 @@ case $PMTYPE in
zypper-rpm
)
zypper-rpm
)
CMD
=
"zypper what-provides"
CMD
=
"zypper what-provides"
;;
;;
opkg
)
CMD
=
"opkg whatprovides"
;;
*
)
*
)
fatal
"Have no suitable command for
$PMTYPE
"
fatal
"Have no suitable command for
$PMTYPE
"
;;
;;
...
@@ -6330,8 +6386,8 @@ docmd $CMD $pkg
...
@@ -6330,8 +6386,8 @@ docmd $CMD $pkg
internal_distr_info
()
internal_distr_info
()
{
{
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Author: Vitaly Lipatov <lav@etersoft.ru>
# 2007, 2009, 2010, 2012, 2016 (c) Etersoft
# 2007, 2009, 2010, 2012, 2016
, 2017, 2018
(c) Etersoft
# 2007-201
6
Public domain
# 2007-201
8
Public domain
# Detect the distro and version
# Detect the distro and version
# Welcome to send updates!
# Welcome to send updates!
...
@@ -6339,6 +6395,8 @@ internal_distr_info()
...
@@ -6339,6 +6395,8 @@ internal_distr_info()
# You can set ROOTDIR to root system dir
# You can set ROOTDIR to root system dir
#ROOTDIR=
#ROOTDIR=
# TODO: check /etc/system-release
# Check for DISTRO specific file in /etc
# Check for DISTRO specific file in /etc
distro
()
distro
()
{
{
...
@@ -6355,11 +6413,24 @@ has()
...
@@ -6355,11 +6413,24 @@ has()
grep
"
$*
"
"
$DISTROFILE
"
>
/dev/null 2>&1
grep
"
$*
"
"
$DISTROFILE
"
>
/dev/null 2>&1
}
}
# Has a system the specified command?
hascommand
()
{
which
$1
2>/dev/null
>
/dev/null
}
firstupper
()
firstupper
()
{
{
echo
"
$*
"
|
sed
's/.*/\u&/'
echo
"
$*
"
|
sed
's/.*/\u&/'
}
}
tolower
()
{
# tr is broken in busybox (checked with OpenWrt)
#echo "$*" | tr "[:upper:]" "[:lower:]"
echo
"
$*
"
|
awk
'{print tolower($0)}'
}
# Translate DISTRIB_ID to vendor name (like %_vendor does)
# Translate DISTRIB_ID to vendor name (like %_vendor does)
rpmvendor
()
rpmvendor
()
{
{
...
@@ -6368,7 +6439,8 @@ rpmvendor()
...
@@ -6368,7 +6439,8 @@ rpmvendor()
[
"
$DISTRIB_ID
"
=
"LinuxXP"
]
&&
echo
"lxp"
&&
return
[
"
$DISTRIB_ID
"
=
"LinuxXP"
]
&&
echo
"lxp"
&&
return
[
"
$DISTRIB_ID
"
=
"TinyCoreLinux"
]
&&
echo
"tcl"
&&
return
[
"
$DISTRIB_ID
"
=
"TinyCoreLinux"
]
&&
echo
"tcl"
&&
return
[
"
$DISTRIB_ID
"
=
"VoidLinux"
]
&&
echo
"void"
&&
return
[
"
$DISTRIB_ID
"
=
"VoidLinux"
]
&&
echo
"void"
&&
return
echo
"
$DISTRIB_ID
"
|
tr
"[:upper:]"
"[:lower:]"
[
"
$DISTRIB_ID
"
=
"OpenSUSE"
]
&&
echo
"suse"
&&
return
tolower
"
$DISTRIB_ID
"
}
}
# Translate DISTRIB_ID name to package manner (like in the package release name)
# Translate DISTRIB_ID name to package manner (like in the package release name)
...
@@ -6393,11 +6465,12 @@ pkgtype()
...
@@ -6393,11 +6465,12 @@ pkgtype()
alpine
)
echo
"apk"
;;
alpine
)
echo
"apk"
;;
tinycorelinux
)
echo
"tcz"
;;
tinycorelinux
)
echo
"tcz"
;;
voidlinux
)
echo
"xbps"
;;
voidlinux
)
echo
"xbps"
;;
openwrt
)
echo
"ipk"
;;
cygwin
)
echo
"tar.xz"
;;
cygwin
)
echo
"tar.xz"
;;
debian|ubuntu|mint|runtu|mcst|astra
)
echo
"deb"
;;
debian|ubuntu|mint|runtu|mcst|astra
)
echo
"deb"
;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles
)
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles
)
echo
"rpm"
;;
echo
"rpm"
;;
fedora|redhat|scientific|centos|rhel|goslinux
)
fedora|redhat|scientific|centos|rhel|goslinux
|amzn
)
echo
"rpm"
;;
echo
"rpm"
;;
*
)
echo
"rpm"
;;
*
)
echo
"rpm"
;;
esac
esac
...
@@ -6460,34 +6533,25 @@ elif distro gentoo-release ; then
...
@@ -6460,34 +6533,25 @@ elif distro gentoo-release ; then
DISTRIB_ID
=
"Gentoo"
DISTRIB_ID
=
"Gentoo"
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/portage/make.profile 2>/dev/null
)
||
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/make.profile
)
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/portage/make.profile 2>/dev/null
)
||
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/make.profile
)
DISTRIB_RELEASE
=
$(
basename
$MAKEPROFILE
)
DISTRIB_RELEASE
=
$(
basename
$MAKEPROFILE
)
echo
$DISTRIB_RELEASE
|
grep
-q
"[0-9]"
||
DISTRIB_RELEASE
=
$(
basename
"
$(
dirname
$MAKEPROFILE
)
"
)
echo
$DISTRIB_RELEASE
|
grep
-q
"[0-9]"
||
DISTRIB_RELEASE
=
$(
basename
"
$(
dirname
$MAKEPROFILE
)
"
)
#"
# Slackware based
elif
distro mopslinux-version
;
then
DISTRIB_ID
=
"MOPSLinux"
if
has 4.0
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has 5.0
;
then
DISTRIB_RELEASE
=
"5.0"
elif
has 5.1
;
then
DISTRIB_RELEASE
=
"5.1"
elif
has 6.0
;
then
DISTRIB_RELEASE
=
"6.0"
elif
has 6.1
;
then
DISTRIB_RELEASE
=
"6.1"
fi
elif
distro slackware-version
;
then
elif
distro slackware-version
;
then
DISTRIB_ID
=
"Slackware"
DISTRIB_ID
=
"Slackware"
DISTRIB_RELEASE
=
"
$(
grep
-Eo
'[0-9]+\.[0-9]+'
$DISTROFILE
)
"
DISTRIB_RELEASE
=
"
$(
grep
-Eo
'[0-9]+\.[0-9]+'
$DISTROFILE
)
"
elif
distro os-release
&&
which apk 2>/dev/null
>
/dev/null
;
then
elif
distro os-release
&&
hascommand apk
;
then
# shellcheck disable=SC1090
# shellcheck disable=SC1090
.
$ROOTDIR
/etc/os-release
.
$ROOTDIR
/etc/os-release
DISTRIB_ID
=
"
$(
firstupper
"
$ID
"
)
"
DISTRIB_ID
=
"
$(
firstupper
"
$ID
"
)
"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
elif
distro os-release
&&
which tce-ab 2>/dev/null
>
/dev/null
;
then
elif
distro os-release
&&
hascommand tce-ab
;
then
# shellcheck disable=SC1090
# shellcheck disable=SC1090
.
$ROOTDIR
/etc/os-release
.
$ROOTDIR
/etc/os-release
DISTRIB_ID
=
"TinyCoreLinux"
DISTRIB_ID
=
"TinyCoreLinux"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
elif
distro os-release
&&
which xbps-query 2>/dev/null
>
/dev/null
;
then
elif
distro os-release
&&
hascommand xbps-query
;
then
# shellcheck disable=SC1090
# shellcheck disable=SC1090
.
$ROOTDIR
/etc/os-release
.
$ROOTDIR
/etc/os-release
DISTRIB_ID
=
"VoidLinux"
DISTRIB_ID
=
"VoidLinux"
...
@@ -6505,6 +6569,11 @@ elif distro mcst_version ; then
...
@@ -6505,6 +6569,11 @@ elif distro mcst_version ; then
DISTRIB_ID
=
"MCST"
DISTRIB_ID
=
"MCST"
DISTRIB_RELEASE
=
$(
cat
"
$DISTROFILE
"
|
grep
"release"
|
sed
-e
"s|.*release
\(
[0-9]*
\)
.*|
\1
|g"
)
DISTRIB_RELEASE
=
$(
cat
"
$DISTROFILE
"
|
grep
"release"
|
sed
-e
"s|.*release
\(
[0-9]*
\)
.*|
\1
|g"
)
# OpenWrt
elif
distro openwrt_release
;
then
.
$DISTROFILE
DISTRIB_RELEASE
=
$(
cat
$ROOTDIR
/etc/openwrt_version
)
elif
distro astra_version
;
then
elif
distro astra_version
;
then
#DISTRIB_ID=`cat $DISTROFILE | get_var DISTRIB_ID`
#DISTRIB_ID=`cat $DISTROFILE | get_var DISTRIB_ID`
DISTRIB_ID
=
"AstraLinux"
DISTRIB_ID
=
"AstraLinux"
...
@@ -6546,26 +6615,6 @@ elif distro mandriva-release || distro mandrake-release ; then
...
@@ -6546,26 +6615,6 @@ elif distro mandriva-release || distro mandrake-release ; then
fi
fi
# Fedora based
# Fedora based
elif
distro linux-xp-release
||
distro lxp-release
;
then
DISTRIB_ID
=
"LinuxXP"
if
has
"Attack of the Clones"
;
then
DISTRIB_RELEASE
=
"2006"
elif
has
"2007"
;
then
DISTRIB_RELEASE
=
"2007"
elif
has
"2008"
;
then
DISTRIB_RELEASE
=
"2008"
elif
has
"2009"
;
then
DISTRIB_RELEASE
=
"2009"
fi
elif
distro asplinux-release
;
then
DISTRIB_ID
=
"ASPLinux"
if
has Karelia
;
then
DISTRIB_RELEASE
=
"10"
elif
has Seliger
;
then
DISTRIB_RELEASE
=
"11"
elif
has
"11.1"
;
then
DISTRIB_RELEASE
=
"11.1"
elif
has Ladoga
;
then
DISTRIB_RELEASE
=
"11.2"
elif
has
"11.2"
;
then
DISTRIB_RELEASE
=
"11.2"
elif
has
"12"
;
then
DISTRIB_RELEASE
=
"12"
elif
has
"13"
;
then
DISTRIB_RELEASE
=
"13"
elif
has
"14"
;
then
DISTRIB_RELEASE
=
"14"
elif
has
"15"
;
then
DISTRIB_RELEASE
=
"15"
fi
elif
distro MCBC-release
;
then
elif
distro MCBC-release
;
then
DISTRIB_ID
=
"MCBC"
DISTRIB_ID
=
"MCBC"
...
@@ -6575,7 +6624,7 @@ elif distro MCBC-release ; then
...
@@ -6575,7 +6624,7 @@ elif distro MCBC-release ; then
elif
distro fedora-release
;
then
elif
distro fedora-release
;
then
DISTRIB_ID
=
"Fedora"
DISTRIB_ID
=
"Fedora"
DISTRIB_RELEASE
=
$(
cat
"
$DISTROFILE
"
|
grep
"release"
|
sed
-e
"s|.*release
\(
[0-9]*
\)
.*|
\1
|g"
)
DISTRIB_RELEASE
=
$(
cat
"
$DISTROFILE
"
|
grep
"release"
|
sed
-e
"s|.*release
\(
[0-9]*
\)
.*|
\1
|g"
)
#"
elif
distro redhat-release
;
then
elif
distro redhat-release
;
then
# FIXME if need
# FIXME if need
...
@@ -6591,14 +6640,11 @@ elif distro redhat-release ; then
...
@@ -6591,14 +6640,11 @@ elif distro redhat-release ; then
if
has Beryllium
;
then
if
has Beryllium
;
then
DISTRIB_ID
=
"Scientific"
DISTRIB_ID
=
"Scientific"
DISTRIB_RELEASE
=
"4.1"
DISTRIB_RELEASE
=
"4.1"
elif
has Shrike
;
then
DISTRIB_ID
=
"RedHat"
DISTRIB_RELEASE
=
"9"
elif
has Taroon
;
then
DISTRIB_RELEASE
=
"3"
elif
has
"release 4"
;
then
DISTRIB_RELEASE
=
"4"
elif
has
"release 4"
;
then
DISTRIB_RELEASE
=
"4"
elif
has
"release 5"
;
then
DISTRIB_RELEASE
=
"5"
elif
has
"release 5"
;
then
DISTRIB_RELEASE
=
"5"
elif
has
"release 6"
;
then
DISTRIB_RELEASE
=
"6"
elif
has
"release 6"
;
then
DISTRIB_RELEASE
=
"6"
elif
has
"release 7"
;
then
DISTRIB_RELEASE
=
"7"
elif
has
"release 7"
;
then
DISTRIB_RELEASE
=
"7"
elif
has
"release 8"
;
then
DISTRIB_RELEASE
=
"8"
fi
fi
# SUSE based
# SUSE based
...
@@ -6618,6 +6664,9 @@ elif distro os-release ; then
...
@@ -6618,6 +6664,9 @@ elif distro os-release ; then
DISTRIB_ID
=
"
$(
firstupper
"
$ID
"
)
"
DISTRIB_ID
=
"
$(
firstupper
"
$ID
"
)
"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
[
-n
"
$DISTRIB_RELEASE
"
]
||
DISTRIB_RELEASE
=
"CUR"
[
-n
"
$DISTRIB_RELEASE
"
]
||
DISTRIB_RELEASE
=
"CUR"
if
[
"
$ID
"
=
"opensuse-leap"
]
;
then
DISTRIB_ID
=
"SUSE"
fi
# fixme: can we detect by some file?
# fixme: can we detect by some file?
elif
[
"
$(
uname
)
"
=
"FreeBSD"
]
;
then
elif
[
"
$(
uname
)
"
=
"FreeBSD"
]
;
then
...
@@ -6636,7 +6685,7 @@ elif [ "$(uname -s 2>/dev/null)" = "Darwin" ] ; then
...
@@ -6636,7 +6685,7 @@ elif [ "$(uname -s 2>/dev/null)" = "Darwin" ] ; then
DISTRIB_RELEASE
=
$(
uname
-r
)
DISTRIB_RELEASE
=
$(
uname
-r
)
# fixme: move to up
# fixme: move to up
elif
[
"
$(
uname
)
"
=
"Linux"
]
&&
which guix 2>/dev/null
>
/dev/null
;
then
elif
[
"
$(
uname
)
"
=
"Linux"
]
&&
hascommand guix
;
then
DISTRIB_ID
=
"GNU/Linux/Guix"
DISTRIB_ID
=
"GNU/Linux/Guix"
DISTRIB_RELEASE
=
$(
uname
-r
)
DISTRIB_RELEASE
=
$(
uname
-r
)
...
@@ -6656,16 +6705,22 @@ elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
...
@@ -6656,16 +6705,22 @@ elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
# fix distro name
# fix distro name
case
"
$DISTRIB_ID
"
in
case
"
$DISTRIB_ID
"
in
"openSUSE Tumbleweed"
)
"openSUSE Tumbleweed"
)
DISTRIB_ID
=
"Tumbleweed"
DISTRIB_ID
=
"SUSE"
DISTRIB_RELEASE
=
"Tumbleweed"
;;
;;
esac
esac
fi
fi
get_uname
()
{
tolower
$(
uname
$1
)
|
tr
-d
"
\t\r\n
"
}
get_base_os_name
()
get_base_os_name
()
{
{
local
DIST_OS
local
DIST_OS
# Resolve the os
# Resolve the os
DIST_OS
=
`
uname
-s
|
tr
[
:upper:]
[
:lower:] |
tr
-d
"
\t\r\n
"
`
DIST_OS
=
"
$(
get_uname
-s
)
"
case
"
$DIST_OS
"
in
case
"
$DIST_OS
"
in
'sunos'
)
'sunos'
)
DIST_OS
=
"solaris"
DIST_OS
=
"solaris"
...
@@ -6686,16 +6741,12 @@ esac
...
@@ -6686,16 +6741,12 @@ esac
echo
"
$DIST_OS
"
echo
"
$DIST_OS
"
}
}
get_uname_m
()
{
uname
-m
|
tr
[
:upper:]
[
:lower:] |
tr
-d
"
\t\r\n
"
}
get_arch
()
get_arch
()
{
{
local
DIST_ARCH
local
DIST_ARCH
# Resolve the architecture
# Resolve the architecture
DIST_ARCH
=
"
$(
get_uname
_
m
)
"
DIST_ARCH
=
"
$(
get_uname
-
m
)
"
case
"
$DIST_ARCH
"
in
case
"
$DIST_ARCH
"
in
'ia32'
|
'i386'
|
'i486'
|
'i586'
|
'i686'
)
'ia32'
|
'i386'
|
'i486'
|
'i586'
|
'i686'
)
DIST_ARCH
=
"x86"
DIST_ARCH
=
"x86"
...
@@ -6736,11 +6787,14 @@ get_bit_size()
...
@@ -6736,11 +6787,14 @@ get_bit_size()
{
{
local
DIST_BIT
local
DIST_BIT
# Check if we are running on 64bit platform, seems like a workaround for now...
# Check if we are running on 64bit platform, seems like a workaround for now...
DIST_BIT
=
"
$(
get_uname
_
m
)
"
DIST_BIT
=
"
$(
get_uname
-
m
)
"
case
"
$DIST_BIT
"
in
case
"
$DIST_BIT
"
in
'amd64'
|
'ia64'
|
'x86_64'
|
'ppc64'
)
'amd64'
|
'ia64'
|
'x86_64'
|
'ppc64'
)
DIST_BIT
=
"64"
DIST_BIT
=
"64"
;;
;;
'aarch64'
)
DIST_BIT
=
"64"
;;
# 'pa_risc' | 'pa-risc') # Are some of these 64bit? Least not all...
# 'pa_risc' | 'pa-risc') # Are some of these 64bit? Least not all...
# BIT="64"
# BIT="64"
# ;;
# ;;
...
@@ -7447,7 +7501,7 @@ $(get_help HELPOPT)
...
@@ -7447,7 +7501,7 @@ $(get_help HELPOPT)
print_version
()
print_version
()
{
{
echo
"EPM package manager version 2.5.
0
"
echo
"EPM package manager version 2.5.
4
"
echo
"Running on
$(
$DISTRVENDOR
)
('
$PMTYPE
' package manager uses '
$PKGFORMAT
' package format)"
echo
"Running on
$(
$DISTRVENDOR
)
('
$PMTYPE
' package manager uses '
$PKGFORMAT
' package format)"
echo
"Copyright (c) Etersoft 2012-2018"
echo
"Copyright (c) Etersoft 2012-2018"
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
...
@@ -7457,7 +7511,7 @@ print_version()
...
@@ -7457,7 +7511,7 @@ print_version()
Usage
=
"Usage: epm [options] <command> [package name(s), package files]..."
Usage
=
"Usage: epm [options] <command> [package name(s), package files]..."
Descr
=
"epm - EPM package manager"
Descr
=
"epm - EPM package manager"
EPMVERSION
=
2.5.
0
EPMVERSION
=
2.5.
4
verbose
=
verbose
=
quiet
=
quiet
=
nodeps
=
nodeps
=
...
...
packed/serv.sh
View file @
de087e1a
...
@@ -37,7 +37,8 @@ load_helper()
...
@@ -37,7 +37,8 @@ load_helper()
inputisatty
()
inputisatty
()
{
{
# check stdin
# check stdin
tty
-s
2>/dev/null
#tty -s 2>/dev/null
test
-t
0
}
}
isatty
()
isatty
()
...
@@ -483,14 +484,14 @@ case $DISTRNAME in
...
@@ -483,14 +484,14 @@ case $DISTRNAME in
ArchLinux
)
ArchLinux
)
CMD
=
"pacman"
CMD
=
"pacman"
;;
;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux
)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux
|Amzn
)
CMD
=
"yum-rpm"
CMD
=
"yum-rpm"
which dnf 2>/dev/null
>
/dev/null
&&
test
-d
/var/lib/dnf/yumdb
&&
CMD
=
dnf-rpm
which dnf 2>/dev/null
>
/dev/null
&&
test
-d
/var/lib/dnf/yumdb
&&
CMD
=
dnf-rpm
;;
;;
Slackware
)
Slackware
)
CMD
=
"slackpkg"
CMD
=
"slackpkg"
;;
;;
SUSE|SLED|SLES
|Tumbleweed
)
SUSE|SLED|SLES
)
CMD
=
"zypper-rpm"
CMD
=
"zypper-rpm"
;;
;;
ForesightLinux|rPathLinux
)
ForesightLinux|rPathLinux
)
...
@@ -502,8 +503,8 @@ case $DISTRNAME in
...
@@ -502,8 +503,8 @@ case $DISTRNAME in
MacOS
)
MacOS
)
CMD
=
"homebrew"
CMD
=
"homebrew"
;;
;;
OpenW
RT
)
OpenW
rt
)
CMD
=
"
i
pkg"
CMD
=
"
o
pkg"
;;
;;
GNU/Linux/Guix
)
GNU/Linux/Guix
)
CMD
=
"guix"
CMD
=
"guix"
...
@@ -1051,8 +1052,8 @@ _print_additional_usage
...
@@ -1051,8 +1052,8 @@ _print_additional_usage
internal_distr_info
()
internal_distr_info
()
{
{
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Author: Vitaly Lipatov <lav@etersoft.ru>
# 2007, 2009, 2010, 2012, 2016 (c) Etersoft
# 2007, 2009, 2010, 2012, 2016
, 2017, 2018
(c) Etersoft
# 2007-201
6
Public domain
# 2007-201
8
Public domain
# Detect the distro and version
# Detect the distro and version
# Welcome to send updates!
# Welcome to send updates!
...
@@ -1060,6 +1061,8 @@ internal_distr_info()
...
@@ -1060,6 +1061,8 @@ internal_distr_info()
# You can set ROOTDIR to root system dir
# You can set ROOTDIR to root system dir
#ROOTDIR=
#ROOTDIR=
# TODO: check /etc/system-release
# Check for DISTRO specific file in /etc
# Check for DISTRO specific file in /etc
distro
()
distro
()
{
{
...
@@ -1076,11 +1079,24 @@ has()
...
@@ -1076,11 +1079,24 @@ has()
grep
"
$*
"
"
$DISTROFILE
"
>
/dev/null 2>&1
grep
"
$*
"
"
$DISTROFILE
"
>
/dev/null 2>&1
}
}
# Has a system the specified command?
hascommand
()
{
which
$1
2>/dev/null
>
/dev/null
}
firstupper
()
firstupper
()
{
{
echo
"
$*
"
|
sed
's/.*/\u&/'
echo
"
$*
"
|
sed
's/.*/\u&/'
}
}
tolower
()
{
# tr is broken in busybox (checked with OpenWrt)
#echo "$*" | tr "[:upper:]" "[:lower:]"
echo
"
$*
"
|
awk
'{print tolower($0)}'
}
# Translate DISTRIB_ID to vendor name (like %_vendor does)
# Translate DISTRIB_ID to vendor name (like %_vendor does)
rpmvendor
()
rpmvendor
()
{
{
...
@@ -1089,7 +1105,8 @@ rpmvendor()
...
@@ -1089,7 +1105,8 @@ rpmvendor()
[
"
$DISTRIB_ID
"
=
"LinuxXP"
]
&&
echo
"lxp"
&&
return
[
"
$DISTRIB_ID
"
=
"LinuxXP"
]
&&
echo
"lxp"
&&
return
[
"
$DISTRIB_ID
"
=
"TinyCoreLinux"
]
&&
echo
"tcl"
&&
return
[
"
$DISTRIB_ID
"
=
"TinyCoreLinux"
]
&&
echo
"tcl"
&&
return
[
"
$DISTRIB_ID
"
=
"VoidLinux"
]
&&
echo
"void"
&&
return
[
"
$DISTRIB_ID
"
=
"VoidLinux"
]
&&
echo
"void"
&&
return
echo
"
$DISTRIB_ID
"
|
tr
"[:upper:]"
"[:lower:]"
[
"
$DISTRIB_ID
"
=
"OpenSUSE"
]
&&
echo
"suse"
&&
return
tolower
"
$DISTRIB_ID
"
}
}
# Translate DISTRIB_ID name to package manner (like in the package release name)
# Translate DISTRIB_ID name to package manner (like in the package release name)
...
@@ -1114,11 +1131,12 @@ pkgtype()
...
@@ -1114,11 +1131,12 @@ pkgtype()
alpine
)
echo
"apk"
;;
alpine
)
echo
"apk"
;;
tinycorelinux
)
echo
"tcz"
;;
tinycorelinux
)
echo
"tcz"
;;
voidlinux
)
echo
"xbps"
;;
voidlinux
)
echo
"xbps"
;;
openwrt
)
echo
"ipk"
;;
cygwin
)
echo
"tar.xz"
;;
cygwin
)
echo
"tar.xz"
;;
debian|ubuntu|mint|runtu|mcst|astra
)
echo
"deb"
;;
debian|ubuntu|mint|runtu|mcst|astra
)
echo
"deb"
;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles
)
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles
)
echo
"rpm"
;;
echo
"rpm"
;;
fedora|redhat|scientific|centos|rhel|goslinux
)
fedora|redhat|scientific|centos|rhel|goslinux
|amzn
)
echo
"rpm"
;;
echo
"rpm"
;;
*
)
echo
"rpm"
;;
*
)
echo
"rpm"
;;
esac
esac
...
@@ -1181,34 +1199,25 @@ elif distro gentoo-release ; then
...
@@ -1181,34 +1199,25 @@ elif distro gentoo-release ; then
DISTRIB_ID
=
"Gentoo"
DISTRIB_ID
=
"Gentoo"
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/portage/make.profile 2>/dev/null
)
||
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/make.profile
)
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/portage/make.profile 2>/dev/null
)
||
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/make.profile
)
DISTRIB_RELEASE
=
$(
basename
$MAKEPROFILE
)
DISTRIB_RELEASE
=
$(
basename
$MAKEPROFILE
)
echo
$DISTRIB_RELEASE
|
grep
-q
"[0-9]"
||
DISTRIB_RELEASE
=
$(
basename
"
$(
dirname
$MAKEPROFILE
)
"
)
echo
$DISTRIB_RELEASE
|
grep
-q
"[0-9]"
||
DISTRIB_RELEASE
=
$(
basename
"
$(
dirname
$MAKEPROFILE
)
"
)
#"
# Slackware based
elif
distro mopslinux-version
;
then
DISTRIB_ID
=
"MOPSLinux"
if
has 4.0
;
then
DISTRIB_RELEASE
=
"4.0"
elif
has 5.0
;
then
DISTRIB_RELEASE
=
"5.0"
elif
has 5.1
;
then
DISTRIB_RELEASE
=
"5.1"
elif
has 6.0
;
then
DISTRIB_RELEASE
=
"6.0"
elif
has 6.1
;
then
DISTRIB_RELEASE
=
"6.1"
fi
elif
distro slackware-version
;
then
elif
distro slackware-version
;
then
DISTRIB_ID
=
"Slackware"
DISTRIB_ID
=
"Slackware"
DISTRIB_RELEASE
=
"
$(
grep
-Eo
'[0-9]+\.[0-9]+'
$DISTROFILE
)
"
DISTRIB_RELEASE
=
"
$(
grep
-Eo
'[0-9]+\.[0-9]+'
$DISTROFILE
)
"
elif
distro os-release
&&
which apk 2>/dev/null
>
/dev/null
;
then
elif
distro os-release
&&
hascommand apk
;
then
# shellcheck disable=SC1090
# shellcheck disable=SC1090
.
$ROOTDIR
/etc/os-release
.
$ROOTDIR
/etc/os-release
DISTRIB_ID
=
"
$(
firstupper
"
$ID
"
)
"
DISTRIB_ID
=
"
$(
firstupper
"
$ID
"
)
"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
elif
distro os-release
&&
which tce-ab 2>/dev/null
>
/dev/null
;
then
elif
distro os-release
&&
hascommand tce-ab
;
then
# shellcheck disable=SC1090
# shellcheck disable=SC1090
.
$ROOTDIR
/etc/os-release
.
$ROOTDIR
/etc/os-release
DISTRIB_ID
=
"TinyCoreLinux"
DISTRIB_ID
=
"TinyCoreLinux"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
elif
distro os-release
&&
which xbps-query 2>/dev/null
>
/dev/null
;
then
elif
distro os-release
&&
hascommand xbps-query
;
then
# shellcheck disable=SC1090
# shellcheck disable=SC1090
.
$ROOTDIR
/etc/os-release
.
$ROOTDIR
/etc/os-release
DISTRIB_ID
=
"VoidLinux"
DISTRIB_ID
=
"VoidLinux"
...
@@ -1226,6 +1235,11 @@ elif distro mcst_version ; then
...
@@ -1226,6 +1235,11 @@ elif distro mcst_version ; then
DISTRIB_ID
=
"MCST"
DISTRIB_ID
=
"MCST"
DISTRIB_RELEASE
=
$(
cat
"
$DISTROFILE
"
|
grep
"release"
|
sed
-e
"s|.*release
\(
[0-9]*
\)
.*|
\1
|g"
)
DISTRIB_RELEASE
=
$(
cat
"
$DISTROFILE
"
|
grep
"release"
|
sed
-e
"s|.*release
\(
[0-9]*
\)
.*|
\1
|g"
)
# OpenWrt
elif
distro openwrt_release
;
then
.
$DISTROFILE
DISTRIB_RELEASE
=
$(
cat
$ROOTDIR
/etc/openwrt_version
)
elif
distro astra_version
;
then
elif
distro astra_version
;
then
#DISTRIB_ID=`cat $DISTROFILE | get_var DISTRIB_ID`
#DISTRIB_ID=`cat $DISTROFILE | get_var DISTRIB_ID`
DISTRIB_ID
=
"AstraLinux"
DISTRIB_ID
=
"AstraLinux"
...
@@ -1267,26 +1281,6 @@ elif distro mandriva-release || distro mandrake-release ; then
...
@@ -1267,26 +1281,6 @@ elif distro mandriva-release || distro mandrake-release ; then
fi
fi
# Fedora based
# Fedora based
elif
distro linux-xp-release
||
distro lxp-release
;
then
DISTRIB_ID
=
"LinuxXP"
if
has
"Attack of the Clones"
;
then
DISTRIB_RELEASE
=
"2006"
elif
has
"2007"
;
then
DISTRIB_RELEASE
=
"2007"
elif
has
"2008"
;
then
DISTRIB_RELEASE
=
"2008"
elif
has
"2009"
;
then
DISTRIB_RELEASE
=
"2009"
fi
elif
distro asplinux-release
;
then
DISTRIB_ID
=
"ASPLinux"
if
has Karelia
;
then
DISTRIB_RELEASE
=
"10"
elif
has Seliger
;
then
DISTRIB_RELEASE
=
"11"
elif
has
"11.1"
;
then
DISTRIB_RELEASE
=
"11.1"
elif
has Ladoga
;
then
DISTRIB_RELEASE
=
"11.2"
elif
has
"11.2"
;
then
DISTRIB_RELEASE
=
"11.2"
elif
has
"12"
;
then
DISTRIB_RELEASE
=
"12"
elif
has
"13"
;
then
DISTRIB_RELEASE
=
"13"
elif
has
"14"
;
then
DISTRIB_RELEASE
=
"14"
elif
has
"15"
;
then
DISTRIB_RELEASE
=
"15"
fi
elif
distro MCBC-release
;
then
elif
distro MCBC-release
;
then
DISTRIB_ID
=
"MCBC"
DISTRIB_ID
=
"MCBC"
...
@@ -1296,7 +1290,7 @@ elif distro MCBC-release ; then
...
@@ -1296,7 +1290,7 @@ elif distro MCBC-release ; then
elif
distro fedora-release
;
then
elif
distro fedora-release
;
then
DISTRIB_ID
=
"Fedora"
DISTRIB_ID
=
"Fedora"
DISTRIB_RELEASE
=
$(
cat
"
$DISTROFILE
"
|
grep
"release"
|
sed
-e
"s|.*release
\(
[0-9]*
\)
.*|
\1
|g"
)
DISTRIB_RELEASE
=
$(
cat
"
$DISTROFILE
"
|
grep
"release"
|
sed
-e
"s|.*release
\(
[0-9]*
\)
.*|
\1
|g"
)
#"
elif
distro redhat-release
;
then
elif
distro redhat-release
;
then
# FIXME if need
# FIXME if need
...
@@ -1312,14 +1306,11 @@ elif distro redhat-release ; then
...
@@ -1312,14 +1306,11 @@ elif distro redhat-release ; then
if
has Beryllium
;
then
if
has Beryllium
;
then
DISTRIB_ID
=
"Scientific"
DISTRIB_ID
=
"Scientific"
DISTRIB_RELEASE
=
"4.1"
DISTRIB_RELEASE
=
"4.1"
elif
has Shrike
;
then
DISTRIB_ID
=
"RedHat"
DISTRIB_RELEASE
=
"9"
elif
has Taroon
;
then
DISTRIB_RELEASE
=
"3"
elif
has
"release 4"
;
then
DISTRIB_RELEASE
=
"4"
elif
has
"release 4"
;
then
DISTRIB_RELEASE
=
"4"
elif
has
"release 5"
;
then
DISTRIB_RELEASE
=
"5"
elif
has
"release 5"
;
then
DISTRIB_RELEASE
=
"5"
elif
has
"release 6"
;
then
DISTRIB_RELEASE
=
"6"
elif
has
"release 6"
;
then
DISTRIB_RELEASE
=
"6"
elif
has
"release 7"
;
then
DISTRIB_RELEASE
=
"7"
elif
has
"release 7"
;
then
DISTRIB_RELEASE
=
"7"
elif
has
"release 8"
;
then
DISTRIB_RELEASE
=
"8"
fi
fi
# SUSE based
# SUSE based
...
@@ -1339,6 +1330,9 @@ elif distro os-release ; then
...
@@ -1339,6 +1330,9 @@ elif distro os-release ; then
DISTRIB_ID
=
"
$(
firstupper
"
$ID
"
)
"
DISTRIB_ID
=
"
$(
firstupper
"
$ID
"
)
"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
[
-n
"
$DISTRIB_RELEASE
"
]
||
DISTRIB_RELEASE
=
"CUR"
[
-n
"
$DISTRIB_RELEASE
"
]
||
DISTRIB_RELEASE
=
"CUR"
if
[
"
$ID
"
=
"opensuse-leap"
]
;
then
DISTRIB_ID
=
"SUSE"
fi
# fixme: can we detect by some file?
# fixme: can we detect by some file?
elif
[
"
$(
uname
)
"
=
"FreeBSD"
]
;
then
elif
[
"
$(
uname
)
"
=
"FreeBSD"
]
;
then
...
@@ -1357,7 +1351,7 @@ elif [ "$(uname -s 2>/dev/null)" = "Darwin" ] ; then
...
@@ -1357,7 +1351,7 @@ elif [ "$(uname -s 2>/dev/null)" = "Darwin" ] ; then
DISTRIB_RELEASE
=
$(
uname
-r
)
DISTRIB_RELEASE
=
$(
uname
-r
)
# fixme: move to up
# fixme: move to up
elif
[
"
$(
uname
)
"
=
"Linux"
]
&&
which guix 2>/dev/null
>
/dev/null
;
then
elif
[
"
$(
uname
)
"
=
"Linux"
]
&&
hascommand guix
;
then
DISTRIB_ID
=
"GNU/Linux/Guix"
DISTRIB_ID
=
"GNU/Linux/Guix"
DISTRIB_RELEASE
=
$(
uname
-r
)
DISTRIB_RELEASE
=
$(
uname
-r
)
...
@@ -1377,16 +1371,22 @@ elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
...
@@ -1377,16 +1371,22 @@ elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
# fix distro name
# fix distro name
case
"
$DISTRIB_ID
"
in
case
"
$DISTRIB_ID
"
in
"openSUSE Tumbleweed"
)
"openSUSE Tumbleweed"
)
DISTRIB_ID
=
"Tumbleweed"
DISTRIB_ID
=
"SUSE"
DISTRIB_RELEASE
=
"Tumbleweed"
;;
;;
esac
esac
fi
fi
get_uname
()
{
tolower
$(
uname
$1
)
|
tr
-d
"
\t\r\n
"
}
get_base_os_name
()
get_base_os_name
()
{
{
local
DIST_OS
local
DIST_OS
# Resolve the os
# Resolve the os
DIST_OS
=
`
uname
-s
|
tr
[
:upper:]
[
:lower:] |
tr
-d
"
\t\r\n
"
`
DIST_OS
=
"
$(
get_uname
-s
)
"
case
"
$DIST_OS
"
in
case
"
$DIST_OS
"
in
'sunos'
)
'sunos'
)
DIST_OS
=
"solaris"
DIST_OS
=
"solaris"
...
@@ -1407,16 +1407,12 @@ esac
...
@@ -1407,16 +1407,12 @@ esac
echo
"
$DIST_OS
"
echo
"
$DIST_OS
"
}
}
get_uname_m
()
{
uname
-m
|
tr
[
:upper:]
[
:lower:] |
tr
-d
"
\t\r\n
"
}
get_arch
()
get_arch
()
{
{
local
DIST_ARCH
local
DIST_ARCH
# Resolve the architecture
# Resolve the architecture
DIST_ARCH
=
"
$(
get_uname
_
m
)
"
DIST_ARCH
=
"
$(
get_uname
-
m
)
"
case
"
$DIST_ARCH
"
in
case
"
$DIST_ARCH
"
in
'ia32'
|
'i386'
|
'i486'
|
'i586'
|
'i686'
)
'ia32'
|
'i386'
|
'i486'
|
'i586'
|
'i686'
)
DIST_ARCH
=
"x86"
DIST_ARCH
=
"x86"
...
@@ -1457,11 +1453,14 @@ get_bit_size()
...
@@ -1457,11 +1453,14 @@ get_bit_size()
{
{
local
DIST_BIT
local
DIST_BIT
# Check if we are running on 64bit platform, seems like a workaround for now...
# Check if we are running on 64bit platform, seems like a workaround for now...
DIST_BIT
=
"
$(
get_uname
_
m
)
"
DIST_BIT
=
"
$(
get_uname
-
m
)
"
case
"
$DIST_BIT
"
in
case
"
$DIST_BIT
"
in
'amd64'
|
'ia64'
|
'x86_64'
|
'ppc64'
)
'amd64'
|
'ia64'
|
'x86_64'
|
'ppc64'
)
DIST_BIT
=
"64"
DIST_BIT
=
"64"
;;
;;
'aarch64'
)
DIST_BIT
=
"64"
;;
# 'pa_risc' | 'pa-risc') # Are some of these 64bit? Least not all...
# 'pa_risc' | 'pa-risc') # Are some of these 64bit? Least not all...
# BIT="64"
# BIT="64"
# ;;
# ;;
...
@@ -2185,7 +2184,7 @@ case $DISTRNAME in
...
@@ -2185,7 +2184,7 @@ case $DISTRNAME in
# ArchLinux)
# ArchLinux)
# CMD="pacman"
# CMD="pacman"
# ;;
# ;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux
)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux
|Amzn
)
CMD
=
"service-chkconfig"
CMD
=
"service-chkconfig"
;;
;;
VoidLinux
)
VoidLinux
)
...
@@ -2194,7 +2193,7 @@ case $DISTRNAME in
...
@@ -2194,7 +2193,7 @@ case $DISTRNAME in
Slackware
)
Slackware
)
CMD
=
"service-initd"
CMD
=
"service-initd"
;;
;;
SUSE|SLED|SLES
|Tumbleweed
)
SUSE|SLED|SLES
)
CMD
=
"service-chkconfig"
CMD
=
"service-chkconfig"
;;
;;
# Windows)
# Windows)
...
@@ -2241,7 +2240,7 @@ $(get_help HELPOPT)
...
@@ -2241,7 +2240,7 @@ $(get_help HELPOPT)
print_version
()
print_version
()
{
{
echo
"Service manager version 2.5.
0
"
echo
"Service manager version 2.5.
4
"
echo
"Running on
$(
$DISTRVENDOR
)
with
$SERVICETYPE
"
echo
"Running on
$(
$DISTRVENDOR
)
with
$SERVICETYPE
"
echo
"Copyright (c) Etersoft 2012-2018"
echo
"Copyright (c) Etersoft 2012-2018"
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
...
...
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