Commit 8eea26d4 authored by Marco Marinello's avatar Marco Marinello

Remove debconf from buster package

Signed-off-by: Marco Marinello's avatarMarco Marinello <me@marcomarinello.it>
parent 1a9eb5d8
......@@ -31,3 +31,8 @@ rebuild-squashfs: prepare-clonezilla
cd live; rm -f filesystem.squashfs; mksquashfs squashfs-root filesystem.squashfs -comp zstd
rm -f live/squashfs-root/home/clonezilla/.ssh/id_rsa
cp live/squashfs-root/home/clonezilla/.ssh/id_rsa.pub utils/clonezilla_live.pub
no-rebuild-squashfs: download
test -e ${CLONEZILLA_SAVE_TO} || wget -O ${CLONEZILLA_SAVE_TO} ${CLONEZILLA_SOURCE}
echo "NO KEY HERE - BUSTER BUILD" > utils/clonezilla_live.pub
#!/bin/bash
. /usr/share/debconf/confmodule
db_input critical fuss-fucc/sftp_directory
db_go
#!/bin/bash
CLONEZILLA_HOME=$(getent passwd clonezilla|cut -d : -f 6)
#
# First of all, place the SSH configuration for clonezilla and root@proxy
#
mkdir -p ${CLONEZILLA_HOME}/.ssh
#rm -rf ${CLONEZILLA_HOME}/.ssh/*
cp /usr/share/fuss-fucc/clonezilla_live.pub ${CLONEZILLA_HOME}/.ssh/authorized_keys
ssh-keyscan -H proxy > ${CLONEZILLA_HOME}/.ssh/known_hosts 2>/dev/null
# Check if the SSH key already exists, if so check if is in authorized-keys
if [ -e ${CLONEZILLA_HOME}/.ssh/id_rsa.pub ] ; then
if ! grep $(cat ${CLONEZILLA_HOME}/.ssh/id_rsa.pub|cut -d ' ' -f 2) /root/.ssh/authorized_keys 2>&1 > /dev/null ; then
echo 'command="if [[ \"$SSH_ORIGINAL_COMMAND\" =~ ^scp[[:space:]]-f ]] || [[ \"$SSH_ORIGINAL_COMMAND\" =~ ^add_client_principal ]] || [[ \"$SSH_ORIGINAL_COMMAND\" =~ rm[[:space:]]/root/ ]]; then $SSH_ORIGINAL_COMMAND; else echo \"Access Denied $SSH_ORIGINAL_COMMAND\"; fi"' $(cat ${CLONEZILLA_HOME}/.ssh/id_rsa.pub) >> /root/.ssh/authorized_keys
fi
else
# else, generate a new keypair and send it to root's authorized keys
ssh-keygen -t rsa -N "" -f ${CLONEZILLA_HOME}/.ssh/id_rsa -C "root@fuss-fucc"
touch /root/.ssh/authorized_keys
mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.old
grep -v "root@fuss-fucc" /root/.ssh/authorized_keys.old > /root/.ssh/authorized_keys
echo 'command="if [[ \"$SSH_ORIGINAL_COMMAND\" =~ ^scp[[:space:]]-f ]] || [[ \"$SSH_ORIGINAL_COMMAND\" =~ ^add_client_principal ]] || [[ \"$SSH_ORIGINAL_COMMAND\" =~ rm[[:space:]]/root/ ]]; then $SSH_ORIGINAL_COMMAND; else echo \"Access Denied $SSH_ORIGINAL_COMMAND\"; fi"' $(cat ${CLONEZILLA_HOME}/.ssh/id_rsa.pub) >> /root/.ssh/authorized_keys
fi
chown -R clonezilla. ${CLONEZILLA_HOME}/.ssh
chmod 400 ${CLONEZILLA_HOME}/.ssh/id_rsa*
#
# Then get the SFTP directoty and copy the files
#
#DEBHELPER#
# Source debconf
. /usr/share/debconf/confmodule
# Get the directory
db_get fuss-fucc/sftp_directory
SFTPDIR="$RET"
# Fix the directory in pxelinux
sed -i "s+/srv/clonezilla+$SFTPDIR+g" /srv/tftp/pxelinux.cfg/default
# Copy required files
mkdir -p $SFTPDIR
cp -R /usr/share/fuss-fucc/clonezilla/clientScripts ${SFTPDIR}
test -e ${SFTPDIR}/computerList.txt || cp /usr/share/fuss-fucc/clonezilla/computerList.txt ${SFTPDIR}
cp /usr/share/fuss-fucc/clonezilla/script ${SFTPDIR}
chown -R clonezilla. ${SFTPDIR}/clientScripts
chmod -R 770 ${SFTPDIR}/clientScripts
chown clonezilla. ${SFTPDIR}/computerList.txt
chown clonezilla. ${SFTPDIR}/script
chmod 770 ${SFTPDIR}/script
mkdir -p /etc/fuss-fucc
echo $SFTPDIR > /etc/fuss-fucc/sftpdir
#!/bin/bash
#DEBHELPER#
rm -rf /srv/tftp/pxelinux.cfg/default /srv/tftp/clonezilla
#!/bin/bash
# Source debconf
. /usr/share/debconf/confmodule
#DEBHELPER#
# Get the directory
db_get fuss-fucc/sftp_directory
SFTPDIR="$RET"
# Remove installed files
rm -rf ${SFTPDIR}/clientScripts
# Do not delete computerList.txt as far as it may still be useful
rm -rf /etc/fuss-fucc
# Prune the debconf database
db_purge
Template: fuss-fucc/sftp_directory
Type: string
Default: /srv/clonezilla
Description: Directory mounted via SSH by clonezilla
In which directory should FUCC-related files be placed?
Should be the same directory that is mounted via SFTP by ocs.
Description-it: Directory montata via SSH da clonezilla
In quale directory devono essere posizionati i file di FUCC?
Deve essere la stessa directory che viene poi montata via SFTP da ocs.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment