Merge branch 'deb_build'

Merge deb-build
pull/52/head
aristocratos 2020-04-27 20:57:22 +02:00
commit b4d2badf6b
7 changed files with 155 additions and 0 deletions

10
DEB/DEBIAN/control Normal file
View File

@ -0,0 +1,10 @@
Package: bashtop
Version: 0.0.0
Section: base
Priority: optional
Architecture: all
Depends: bash (>= 4.4),curl (>= 7.16.2), coreutils, sed, awk, grep
Maintainer: your_name <xxx@xxx.xxx>
Description: Resource monitor that shows usage
and stats for processor, memory, disks, network and processes
Homepage: https://github.com/aristocratos/bashtop

4
DEB/DEBIAN/postinst Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
echo -e "[\033[1;32m done \033[0m]"

4
DEB/DEBIAN/postrm Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
echo -e "[\033[1;32m successfully removed \033[0m]"

4
DEB/DEBIAN/preinst Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
echo -e "[\033[1;32m starting intallation \033[0m]"

4
DEB/DEBIAN/prerm Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
echo -e "[\033[1;33m removing packet from the system \033[0m]"

115
DEB/build Executable file
View File

@ -0,0 +1,115 @@
#!/bin/bash
# this little script is just to automate the creation of the .deb package under debian and also the automatic installation of the bashtop program in the system.
# How does it work?
# ----
# It parses the bashtop file to retrieve the last version specified in the script to allow a fresh creation of the .deb package
# +by also retrieving the most recent version of the script then it proceeds to the installation ...
set -o errexit
#set -x # just for debuging
readonly file_src_location=../bashtop # bashtop location ^
readonly ubin=usr/bin/
readonly file_name=${file_src_location##*/}
readonly ctrl_file=DEBIAN/control
readonly architecture=amd64 # for all architectures
readonly root_uid=0
declare version build_version
[[ ROOT::PERMISSION ]]
{
[[ $UID -ne ${root_uid} ]] && {
echo -e "require root user"
exit $UID
}
}
[[ ARGUMENTS::HANDLER ]]
{
if [[ -n $1 ]] ; then
case $1 in
"--remove")
[[ -x /${ubin}/${file_name} ]] && {
dpkg --remove ${file_name}
test $? -eq 0 && exit 0
}||{
echo -e "~ nothing todo: bashtop is removed "
exit 0
}
;;
esac
fi
}
echo -e "+ building package ..."
sleep 1
[[ FILECHECK ]]
{
#+ require bashtop file to read inside
[[ ! -f ${file_src_location} ]] && {
echo -e "undefine ${file_name}"
exit 3 # just a basic exit
}|| {
echo -e "+ populate DEB folder "
[[ -d $ubin ]] || mkdir -p $ubin
`cp $file_src_location $ubin`
}
#+ require control file to write inside
[[ ! -f ${ctrl_file} ]] && {
echo -e "undefined ${ctrl_file##*/}"
exit 3
}
}
[[ IO::SEMVERS ]]
{
echo -e "+ fetching the lastest version of ${file_name}"
get_current_version () {
local watch_version=`grep -i "declare version" ${file_src_location}`
local semvers=${watch_version##*=}
echo ${semvers:1:-1}
}
set_new_version_ctrl() {
local catch_package_version=`grep -i version ${ctrl_file}`
version=${catch_package_version%%:*}
build_version=${catch_package_version##*:}
[[ -n $1 ]] && build_version=$1
version+=": ${build_version}"
echo -e "+ set new version control"
`sed -i "s/$catch_package_version/${version}/g" ${ctrl_file}`
}
set_new_version_ctrl $(get_current_version)
}
[[ PACKAGER_BUILD::DEB ]]
{
build_for_debian_base (){
local debian_package_name=${file_name}_${build_version}-${architecture}.deb
#echo ${debian_package_name}
dpkg-deb --build ../DEB ${debian_package_name}
test $? -eq 0 && {
if [[ -f ${debian_package_name} ]] ;then
dpkg -i ${debian_package_name}
[[ $? -eq 0 ]] && {
exit $?
}||{
echo -e "Installation failed"
exit $?
}
fi
}||{
echo -e "build failed"
exit 5
}
}
build_for_debian_base
}

View File

@ -100,6 +100,20 @@ Also available in the AUR as [bashtop-git](https://aur.archlinux.org/packages/ba
Also available for debian/ubuntu from [Azlux's repository](http://packages.azlux.fr/)
Or use quick installation
>quick install go to DEB folder and type
```
sudo ./build
```
>to uninstall it go to DEB folder and type
```
sudo ./build --remove
```
## Configurability
All options changeable from within UI.