mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 10:37:42 -07:00
Merge changes from upstream
I'm a little angry
This commit is contained in:
parent
dcf849263d
commit
2b16d9bd83
254 changed files with 24485 additions and 24094 deletions
|
@ -1,65 +1,65 @@
|
|||
#!/bin/bash
|
||||
# info: list system interfaces
|
||||
# options: [format]
|
||||
#
|
||||
# The function for obtaining the list of network interfaces.
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
format=${1-shell}
|
||||
|
||||
# Includes
|
||||
source $VESTA/func/main.sh
|
||||
|
||||
# Json function
|
||||
json_list_iface() {
|
||||
dev=$(cat /proc/net/dev |grep : |cut -f 1 -d : |tr -d ' ' |grep -v lo)
|
||||
int_counter=$(echo "$dev" | wc -l)
|
||||
i=1
|
||||
echo '['
|
||||
for interface in $dev; do
|
||||
if [ "$i" -lt "$int_counter" ]; then
|
||||
echo -e "\t\"$interface\","
|
||||
else
|
||||
echo -e "\t\"$interface\""
|
||||
fi
|
||||
(( ++i))
|
||||
done
|
||||
echo "]"
|
||||
}
|
||||
|
||||
# Shell function
|
||||
shell_list_iface() {
|
||||
dev=$(cat /proc/net/dev |grep : |cut -f 1 -d : |tr -d ' ' |grep -v lo)
|
||||
if [ -z "$nohead" ]; then
|
||||
echo "INTERFACES"
|
||||
echo "----------"
|
||||
fi
|
||||
for interface in $dev; do
|
||||
echo "$interface"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Listing domains
|
||||
case $format in
|
||||
json) json_list_iface ;;
|
||||
plain) nohead=1; shell_list_iface ;;
|
||||
shell) shell_list_iface ;;
|
||||
*) check_args '1' '0' '[format]' ;;
|
||||
esac
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
exit
|
||||
#!/bin/bash
|
||||
# info: list system interfaces
|
||||
# options: [FORMAT]
|
||||
#
|
||||
# The function for obtaining the list of network interfaces.
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
format=${1-shell}
|
||||
|
||||
# Includes
|
||||
source $VESTA/func/main.sh
|
||||
|
||||
# Json function
|
||||
json_list_iface() {
|
||||
dev=$(cat /proc/net/dev |grep : |cut -f 1 -d : |tr -d ' ' |grep -v lo)
|
||||
int_counter=$(echo "$dev" | wc -l)
|
||||
i=1
|
||||
echo '['
|
||||
for interface in $dev; do
|
||||
if [ "$i" -lt "$int_counter" ]; then
|
||||
echo -e "\t\"$interface\","
|
||||
else
|
||||
echo -e "\t\"$interface\""
|
||||
fi
|
||||
(( ++i))
|
||||
done
|
||||
echo "]"
|
||||
}
|
||||
|
||||
# Shell function
|
||||
shell_list_iface() {
|
||||
dev=$(cat /proc/net/dev |grep : |cut -f 1 -d : |tr -d ' ' |grep -v lo)
|
||||
if [ -z "$nohead" ]; then
|
||||
echo "INTERFACES"
|
||||
echo "----------"
|
||||
fi
|
||||
for interface in $dev; do
|
||||
echo "$interface"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Listing domains
|
||||
case $format in
|
||||
json) json_list_iface ;;
|
||||
plain) nohead=1; shell_list_iface ;;
|
||||
shell) shell_list_iface ;;
|
||||
*) check_args '1' '0' '[FORMAT]' ;;
|
||||
esac
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
exit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue