Trim trailing whitespace, use tab indentation consistently

This should avoid conflicts in future pull requests.
pull/68/head
Hugo Locurcio 2020-04-28 19:11:01 +02:00
parent 57669c6198
commit dbaf18eb22
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C
14 changed files with 328 additions and 330 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

100
DEB/build
View File

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

View File

@ -1,7 +1,7 @@
# ![bashtop](logo-t.png) # ![bashtop](logo-t.png)
**Usage:** Linux resource monitor **Usage:** Linux resource monitor
**Language:** Bash **Language:** Bash
## Index ## Index
@ -71,7 +71,7 @@ Should work on most modern linux distributions with a truecolor capable terminal
## Dependencies ## Dependencies
**[bash](https://www.gnu.org/software/bash/)** (v4.4 or later) Script functionality will most probably break with earlier versions. **[bash](https://www.gnu.org/software/bash/)** (v4.4 or later) Script functionality will most probably break with earlier versions.
Bash version 5 is highly recommended to make use of $EPOCHREALTIME variable instead of a lot of external date command calls. Bash version 5 is highly recommended to make use of $EPOCHREALTIME variable instead of a lot of external date command calls.
**[GNU Core Utilities](https://www.gnu.org/software/coreutils/)** **[GNU Core Utilities](https://www.gnu.org/software/coreutils/)**
@ -90,13 +90,13 @@ Bash version 5 is highly recommended to make use of $EPOCHREALTIME variable inst
## Screenshots ## Screenshots
Main UI showing details for a selected process. Main UI showing details for a selected process.
![Screenshot 1](main.png) ![Screenshot 1](main.png)
Main menu. Main menu.
![Screenshot 2](menu.png) ![Screenshot 2](menu.png)
Options menu. Options menu.
![Screenshot 3](options.png) ![Screenshot 3](options.png)
## Installation ## Installation

508
bashtop

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@ theme[title]="#ee"
theme[hi_fg]="#90" theme[hi_fg]="#90"
# Background color of selected item in processes box # Background color of selected item in processes box
theme[selected_bg]="#7e2626" theme[selected_bg]="#7e2626"
# Foreground color of selected item in processes box # Foreground color of selected item in processes box
theme[selected_fg]="#ee" theme[selected_fg]="#ee"
@ -86,4 +86,4 @@ theme[download_end]="#b0a9de"
# Upload graph colors # Upload graph colors
theme[upload_start]="#510554" theme[upload_start]="#510554"
theme[upload_mid]="#7d4180" theme[upload_mid]="#7d4180"
theme[upload_end]="#dcafde" theme[upload_end]="#dcafde"

View File

@ -22,7 +22,7 @@ theme[title]="#cc"
theme[hi_fg]="#90" theme[hi_fg]="#90"
# Background color of selected item in processes box # Background color of selected item in processes box
theme[selected_bg]="#ff" theme[selected_bg]="#ff"
# Foreground color of selected item in processes box # Foreground color of selected item in processes box
theme[selected_fg]="#00" theme[selected_fg]="#00"
@ -86,4 +86,4 @@ theme[download_end]="#ff"
# Upload graph colors # Upload graph colors
theme[upload_start]="#30" theme[upload_start]="#30"
theme[upload_mid]="" theme[upload_mid]=""
theme[upload_end]="#ff" theme[upload_end]="#ff"

View File

@ -22,7 +22,7 @@ theme[title]="#F8F8F2"
theme[hi_fg]="#F92672" theme[hi_fg]="#F92672"
# Background color of selected item in processes box # Background color of selected item in processes box
theme[selected_bg]="#7a1137" theme[selected_bg]="#7a1137"
# Foreground color of selected item in processes box # Foreground color of selected item in processes box
theme[selected_fg]="#F8F8F2" theme[selected_fg]="#F8F8F2"
@ -86,4 +86,4 @@ theme[download_end]="#ccaefc"
# Upload graph colors # Upload graph colors
theme[upload_start]="#570d33" theme[upload_start]="#570d33"
theme[upload_mid]="#cf277d" theme[upload_mid]="#cf277d"
theme[upload_end]="#fa91c7" theme[upload_end]="#fa91c7"

View File

@ -22,7 +22,7 @@ theme[title]="#F8F8F2"
theme[hi_fg]="#F92672" theme[hi_fg]="#F92672"
# Background color of selected item in processes box # Background color of selected item in processes box
theme[selected_bg]="#7a1137" theme[selected_bg]="#7a1137"
# Foreground color of selected item in processes box # Foreground color of selected item in processes box
theme[selected_fg]="#F8F8F2" theme[selected_fg]="#F8F8F2"
@ -86,4 +86,4 @@ theme[download_end]="#ccaefc"
# Upload graph colors # Upload graph colors
theme[upload_start]="#570d33" theme[upload_start]="#570d33"
theme[upload_mid]="#cf277d" theme[upload_mid]="#cf277d"
theme[upload_end]="#fa91c7" theme[upload_end]="#fa91c7"

View File

@ -22,7 +22,7 @@ theme[title]="#fdf6e3"
theme[hi_fg]="#b58900" theme[hi_fg]="#b58900"
# Background color of selected items # Background color of selected items
theme[selected_bg]="#073642" theme[selected_bg]="#073642"
# Foreground color of selected items # Foreground color of selected items
theme[selected_fg]="#d6a200" theme[selected_fg]="#d6a200"
@ -86,4 +86,4 @@ theme[download_end]="#a3a8f7"
# Upload graph colors # Upload graph colors
theme[upload_start]="#701c45" theme[upload_start]="#701c45"
theme[upload_mid]="#d33682" theme[upload_mid]="#d33682"
theme[upload_end]="#f56caf" theme[upload_end]="#f56caf"

View File

@ -22,7 +22,7 @@ theme[title]="#10"
theme[hi_fg]="#284d75" theme[hi_fg]="#284d75"
# Background color of selected item in processes box # Background color of selected item in processes box
theme[selected_bg]="#15283d" theme[selected_bg]="#15283d"
# Foreground color of selected item in processes box # Foreground color of selected item in processes box
theme[selected_fg]="#ff" theme[selected_fg]="#ff"
@ -86,4 +86,4 @@ theme[download_end]="#130f29"
# Upload graph colors # Upload graph colors
theme[upload_start]="#f590f9" theme[upload_start]="#f590f9"
theme[upload_mid]="#722e76" theme[upload_mid]="#722e76"
theme[upload_end]="#2b062d" theme[upload_end]="#2b062d"