[Code formatting: Change indentation style to space](https://github.com/clicon/clixon/issues/379)

* Applies to all c/h/y/l/sh files and .editorconfig
This commit is contained in:
Olof hagsand 2022-10-27 14:21:17 +02:00
parent a9d1ab006c
commit d84c529ff1
376 changed files with 38147 additions and 38133 deletions

View file

@ -19,7 +19,7 @@ if [ ! $(id -u clicon) ]; then
elif [ $release = "alpine" ]; then
sudo adduser -D -H clicon
sudo adduser $wwwuser clicon
else
else
sudo useradd -M -U clicon;
sudo usermod -a -G clicon vagrant; # start clixon tests as this users
sudo usermod -a -G clicon $wwwuser;
@ -29,7 +29,7 @@ fi
# Fcgi restconf requires /www-data directory for fcgi socket
if [ ${with_restconf} = fcgi ]; then
if [ ! -d /www-data ]; then
sudo mkdir /www-data
sudo mkdir /www-data
fi
sudo chown $wwwuser /www-data
sudo chgrp $wwwuser /www-data

View file

@ -13,7 +13,7 @@ for pid in $pids; do
# echo "ps -o rss,vsize,cmd -h -p $pid"
line=$(ps -o rss,vsize,cmd -h -p $pid)
if [ -z "$line" ]; then
continue;
continue;
fi
rss=$(echo "$line"| awk '{print $1}')
let rss=rss/1000

View file

@ -50,18 +50,18 @@ http {
listen 80 default_server;
listen localhost:80 default_server;
listen [::]:80 default_server;
server_name localhost;
server_name _;
server_name localhost;
server_name _;
#:well-known is in root, otherwise restconf would be ok
location / {
fastcgi_pass unix:/www-data/fastcgi_restconf.sock;
include fastcgi_params;
location / {
fastcgi_pass unix:/www-data/fastcgi_restconf.sock;
include fastcgi_params;
}
location /streams {
fastcgi_pass unix:/www-data/fastcgi_restconf.sock;
include fastcgi_params;
proxy_http_version 1.1;
proxy_set_header Connection "";
location /streams {
fastcgi_pass unix:/www-data/fastcgi_restconf.sock;
include fastcgi_params;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
}
}
@ -74,20 +74,20 @@ cat<<'EOF' > $dir/startnginx.sh
if [ $# -ne 0 -a $# -ne 1 ]; then
echo "usage: $0 [<prefix>"]
exit
fi
fi
prefix=$1
# start nginx
sudo cp nginx.conf $prefix/etc/nginx/
if [ -d /etc/rc.conf ]; then # freebsd
if [ ! $(grep nginx_enable /etc/rc.conf) ]; then
sudo sh -c ' echo 'nginx_enable="YES"' >> /etc/rc.conf'
fi
sudo sh -c ' echo 'nginx_enable="YES"' >> /etc/rc.conf'
fi
sudo /usr/local/etc/rc.d/nginx restart
else
sudo pkill nginx
else
sudo pkill nginx
nginxbin=$(sudo which nginx)
sudo $nginxbin -c $prefix/etc/nginx/nginx.conf
sudo $nginxbin -c $prefix/etc/nginx/nginx.conf
fi
EOF

View file

@ -29,18 +29,18 @@ linuxrelease()
box=$1
release="unknown"
for r in freebsd openbsd opensuse ubuntu centos coreos alpine debian arch gentoo fedora rhel; do
# -i ignore case
if [ -n "$(echo "$box" | grep -io "$r")" ]; then
release=$r
break
fi
# -i ignore case
if [ -n "$(echo "$box" | grep -io "$r")" ]; then
release=$r
break
fi
done
# Special cases
if [ "$release" = "unknown" ]; then
if [ -n "$(echo "$box" | grep -io "bionic")" ]; then
release=ubuntu
break;
fi
if [ -n "$(echo "$box" | grep -io "bionic")" ]; then
release=ubuntu
break;
fi
fi
echo "$release"
}
@ -112,148 +112,148 @@ system=$($sshcmd uname) # we use the release "hack" instead
buildfcgi=false
case $release in
openbsd)
# packages for building
$sshcmd sudo pkg install -y git gmake bash
# cligen
$sshcmd sudo pkg install -y bison flex
# Add restconf user
if [ ! $($sshcmd id -u $wwwuser) ]; then
$sshcmd sudo pw useradd $wwwuser -d /nonexistent -s /usr/sbin/nologin
fi
case ${with_restconf} in
fcgi)
$sshcmd sudo pkg install -y fcgi-devkit nginx
;;
native)
;;
esac
# packages for building
$sshcmd sudo pkg install -y git gmake bash
# cligen
$sshcmd sudo pkg install -y bison flex
# Add restconf user
if [ ! $($sshcmd id -u $wwwuser) ]; then
$sshcmd sudo pw useradd $wwwuser -d /nonexistent -s /usr/sbin/nologin
fi
case ${with_restconf} in
fcgi)
$sshcmd sudo pkg install -y fcgi-devkit nginx
;;
native)
;;
esac
;;
freebsd)
# packages for building
$sshcmd sudo pkg install -y git gmake bash
# cligen
$sshcmd sudo pkg install -y bison flex
# Add restconf user
if [ ! $($sshcmd id -u $wwwuser) ]; then
$sshcmd sudo pw useradd $wwwuser -d /nonexistent -s /usr/sbin/nologin
fi
case ${with_restconf} in
fcgi)
$sshcmd sudo pkg install -y fcgi-devkit nginx
;;
native)
;;
esac
;;
# packages for building
$sshcmd sudo pkg install -y git gmake bash
# cligen
$sshcmd sudo pkg install -y bison flex
# Add restconf user
if [ ! $($sshcmd id -u $wwwuser) ]; then
$sshcmd sudo pw useradd $wwwuser -d /nonexistent -s /usr/sbin/nologin
fi
case ${with_restconf} in
fcgi)
$sshcmd sudo pkg install -y fcgi-devkit nginx
;;
native)
;;
esac
;;
centos)
# enable ipv6
$sshcmd sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
# add restconf user: $wwwuser
if [ ! $($sshcmd id -u $wwwuser) ]; then
$sshcmd sudo useradd -M $wwwuser
fi
# packages for building
$sshcmd sudo yum install -y git make
# cligen
$sshcmd sudo yum install -y bison flex
# clixon utilities
$sshcmd sudo yum install -y time libcurl-devel gcc-c++
# restconf
case ${with_restconf} in
fcgi)
buildfcgi=true # build fcgi from source
$sshcmd sudo yum install -y epel-release
# $sshcmd sudo yum update
$sshcmd sudo yum install -y nginx
;;
native)
$sshcmd sudo yum install -y openssl
$sshcmd sudo yum install -y openssl-devel
$sshcmd sudo yum-config-manager --enable powertools
$sshcmd sudo yum install -y libnghttp2-devel
;;
esac
;;
# add restconf user: $wwwuser
if [ ! $($sshcmd id -u $wwwuser) ]; then
$sshcmd sudo useradd -M $wwwuser
fi
# packages for building
$sshcmd sudo yum install -y git make
# cligen
$sshcmd sudo yum install -y bison flex
# clixon utilities
$sshcmd sudo yum install -y time libcurl-devel gcc-c++
# restconf
case ${with_restconf} in
fcgi)
buildfcgi=true # build fcgi from source
$sshcmd sudo yum install -y epel-release
# $sshcmd sudo yum update
$sshcmd sudo yum install -y nginx
;;
native)
$sshcmd sudo yum install -y openssl
$sshcmd sudo yum install -y openssl-devel
$sshcmd sudo yum-config-manager --enable powertools
$sshcmd sudo yum install -y libnghttp2-devel
;;
esac
;;
opensuse) # opensuse42
# restconf user: $wwwuser
if [ ! $($sshcmd id -u $wwwuser) ]; then
$sshcmd sudo useradd -M -U $wwwuser
fi
# packages for building
$sshcmd sudo zypper install -y git
# cligen
$sshcmd sudo zypper install -y bison flex
# clixon utilities
$sshcmd sudo zypper install -y libcurl-devel gcc-c++
# restconf
case ${with_restconf} in
fcgi)
$sshcmd sudo zypper install -y nginx
buildfcgi=true # build fcgi from source
;;
native)
;;
esac
;;
# restconf user: $wwwuser
if [ ! $($sshcmd id -u $wwwuser) ]; then
$sshcmd sudo useradd -M -U $wwwuser
fi
# packages for building
$sshcmd sudo zypper install -y git
# cligen
$sshcmd sudo zypper install -y bison flex
# clixon utilities
$sshcmd sudo zypper install -y libcurl-devel gcc-c++
# restconf
case ${with_restconf} in
fcgi)
$sshcmd sudo zypper install -y nginx
buildfcgi=true # build fcgi from source
;;
native)
;;
esac
;;
ubuntu) # ubuntu/apt based
# enable ipv6
$sshcmd sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
$sshcmd sudo apt-get update --fix-missing
$sshcmd sudo apt install -y git
# restconf user: $wwwuser
if [ ! $($sshcmd id -u $wwwuser) ]; then
$sshcmd sudo useradd -M $wwwuser
fi
# cligen
$sshcmd sudo apt install -y bison flex make
# clixon utilities
$sshcmd sudo apt install -y libcurl4-openssl-dev
$sshcmd sudo apt install -y g++
# restconf
case ${with_restconf} in
fcgi)
buildfcgi=true # some ubuntu dont have fcgi-dev
$sshcmd sudo apt install -y nginx
;;
native)
$sshcmd sudo apt install -y libssl-dev
$sshcmd sudo apt install -y libnghttp2-dev # nghttp2
;;
esac
;;
$sshcmd sudo apt-get update --fix-missing
$sshcmd sudo apt install -y git
# restconf user: $wwwuser
if [ ! $($sshcmd id -u $wwwuser) ]; then
$sshcmd sudo useradd -M $wwwuser
fi
# cligen
$sshcmd sudo apt install -y bison flex make
# clixon utilities
$sshcmd sudo apt install -y libcurl4-openssl-dev
$sshcmd sudo apt install -y g++
# restconf
case ${with_restconf} in
fcgi)
buildfcgi=true # some ubuntu dont have fcgi-dev
$sshcmd sudo apt install -y nginx
;;
native)
$sshcmd sudo apt install -y libssl-dev
$sshcmd sudo apt install -y libnghttp2-dev # nghttp2
;;
esac
;;
alpine)
if [ ! $($sshcmd id -u $wwwuser) ]; then
if [ ! $($sshcmd id -u $wwwuser) ]; then
$sshcmd sudo adduser -D -H $wwwuser
fi
$sshcmd sudo apk add --update git make build-base gcc flex bison curl-dev g++
# restconf
case ${with_restconf} in
fcgi)
$sshcmd sudo apk add --update nginx fcgi-dev
;;
native)
;;
esac
;;
fi
$sshcmd sudo apk add --update git make build-base gcc flex bison curl-dev g++
# restconf
case ${with_restconf} in
fcgi)
$sshcmd sudo apk add --update nginx fcgi-dev
;;
native)
;;
esac
;;
arch)
$sshcmd sudo useradd -M $wwwuser
useradd -m -G additional_groups -s login_shell username
$sshcmd sudo pacman -Syu --noconfirm git
# cligen
$sshcmd sudo pacman -Syu --noconfirm bison flex make
# restconf
case ${with_restconf} in
fcgi)
$sshcmd sudo pacman -Syu --noconfirm nginx fcgi
;;
native)
;;
esac
;;
$sshcmd sudo useradd -M $wwwuser
useradd -m -G additional_groups -s login_shell username
$sshcmd sudo pacman -Syu --noconfirm git
# cligen
$sshcmd sudo pacman -Syu --noconfirm bison flex make
# restconf
case ${with_restconf} in
fcgi)
$sshcmd sudo pacman -Syu --noconfirm nginx fcgi
;;
native)
;;
esac
;;
*)
echo "Unknown release: $release"
;;
echo "Unknown release: $release"
;;
esac
# Some platforms dont have fcgi, build the source (should all?)
@ -266,11 +266,11 @@ fi
case ${with_restconf} in
fcgi)
# Hide all complex nginx config in sub-script
. ./nginx.sh $dir $idfile $port $wwwuser
;;
# Hide all complex nginx config in sub-script
. ./nginx.sh $dir $idfile $port $wwwuser
;;
native)
;;
;;
esac
# Setup cligen and clixon