merge wip
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

- added client shell
- fixed amgmt user creation
- fix creation of httpd config
This commit is contained in:
Paolo Asperti 2020-03-01 22:17:25 +01:00
parent 83bf64bd39
commit 31d6f096cf
Signed by: paspo
GPG Key ID: 06D46905D19D5182
3 changed files with 28 additions and 32 deletions

View File

@ -51,33 +51,3 @@ steps:
file_exists: skip
when:
event: tag
- name: repo_upload
image: appleboy/drone-scp
settings:
source: out/*.noarch.rpm
target: /vhosts/repo.libreschool.org/https/nethserver/7/devel/x86_64/Packages/
host: repo.libreschool.org
strip_components: 1
username:
from_secret: ssh_username
key:
from_secret: ssh_key
when:
event: tag
repo: LibreSchool/libreschool-client-manager
- name: repo_upload_srpms
image: appleboy/drone-scp
settings:
source: out/*.src.rpm
target: /vhosts/repo.libreschool.org/https/nethserver/7/devel/Source/SPackages/
host: repo.libreschool.org
strip_components: 1
username:
from_secret: ssh_username
key:
from_secret: ssh_key
when:
event: tag
repo: LibreSchool/libreschool-client-manager

View File

@ -1,6 +1,6 @@
Summary: LibreSchool Client Manager
Name: libreschool-client-manager
Version: 1.0
Version: 1.0.1
Release: 1.ns7
License: GPL
BuildArch: noarch
@ -47,7 +47,16 @@ mkdir -p %{buildroot}%{_localstatedir}/cache/client-manager
%defattr(-,root,root)
%pre
/usr/bin/getent passwd amgmt || /usr/sbin/useradd -r -g wheel -d /home/amgmt -s /sbin/nologin amgmt
/usr/bin/getent passwd amgmt || /usr/sbin/useradd -r -m -g wheel -d /home/amgmt -s /sbin/nologin amgmt
if [ ! -d /home/amgmt/.ssh ] ; then
mkdir -p /home/amgmt/.ssh
fi
chmod 0700 /home/amgmt /home/amgmt/.ssh
chown -R amgmt:wheel /home/amgmt
if [ ! -f /home/amgmt/.ssh/id_rsa ] ; then
cat /dev/zero | sudo -u amgmt ssh-keygen -q -N ""
fi
if [ "$1" = 2 ]; then
#upgrade
/usr/bin/systemctl stop client-manager >/dev/null 2>&1 || :
@ -58,6 +67,7 @@ fi
[ -e /usr/sbin/client-manager ] && [ ! -L /usr/sbin/client-manager ] && rm /usr/sbin/client-manager
[ ! -L /usr/sbin/client-manager ] && ln -s httpd /usr/sbin/client-manager
/sbin/e-smith/expand-template /etc/sudoers
[ ! -d /etc/httpd/client-manager ] && mkdir /etc/httpd/client-manager
/sbin/e-smith/expand-template /etc/httpd/client-manager/httpd.conf
/sbin/e-smith/expand-template /etc/ansible/reconfigure_clients.yml
/sbin/e-smith/signal-event runlevel-adjust

16
root/usr/bin/client-shell Normal file
View File

@ -0,0 +1,16 @@
#!/bin/sh
if [ "$1" = "" ] ; then
echo "Usage:"
echo "$0 [hostname]"
exit 1
fi
USER=$(db hosts getprop "$1" sshUser)
if [ "$USER" = "" ] ; then
echo "Can't find an user for $1"
exit 1
fi
/usr/bin/sudo -u amgmt /usr/bin/ssh -o StrictHostKeyChecking=no ${USER}\@${1} ${@:2}