...
 
Commits (2)
#!/bin/sh
### BEGIN INIT INFO
# Provides: octavia-agent-certs-ramfs
# Required-Start: $remote_fs $syslog $network cloud-config
......@@ -12,35 +13,35 @@
# Using the lsb functions to perform the operations.
. /lib/lsb/init-functions
# Process name ( For display )
NAME=certs-ramfs
NAME=octavia-agent-certs-ramfs
case $1 in
start)
log_daemon_msg "Starting the process" "$NAME"
modprobe brd
passphrase=$(head /dev/urandom | tr -dc "a-zA-Z0-9" | fold -w 32 | head -n 1)
certs_path=$(awk "/base_cert_dir / {printf \$3}" /etc/octavia/amphora-agent.conf)
mkdir -p "${certs_path}"
echo -n "${passphrase}" | cryptsetup luksFormat /dev/ram0 -
echo -n "${passphrase}" | cryptsetup luksOpen /dev/ram0 certfs-ramfs -
mkfs.ext2 /dev/mapper/certfs-ramfs
mount /dev/mapper/certfs-ramfs "${certs_path}"
log_end_msg 0
;;
stop)
log_daemon_msg "Stopping the process" "$NAME"
certs_path=$(awk "/base_cert_dir / {printf \$3}" /etc/octavia/amphora-agent.conf)
umount "${certs_path}"
cryptsetup luksClose /dev/mapper/certfs-ramfs
log_end_msg 0
;;
restart)
# Restart the daemon.
$0 stop && sleep 2 && $0 start
;;
*)
# For invalid arguments, print the usage message.
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 2
;;
start)
log_daemon_msg "Starting Octavia Agent RAMDISK" "$NAME"
modprobe brd rd_size=1024000 max_part=2 rd_nr=1
passphrase=$(head /dev/urandom | tr -dc "a-zA-Z0-9" | fold -w 32 | head -n 1)
certs_path=$(grep base_cert_dir /etc/octavia/amphora-agent.conf | awk '{print $3}')
mkdir -p "${certs_path}"
echo -n "${passphrase}" | cryptsetup luksFormat /dev/ram0 -
echo -n "${passphrase}" | cryptsetup luksOpen /dev/ram0 certfs-ramfs -
mkfs.ext2 /dev/mapper/certfs-ramfs
mount /dev/mapper/certfs-ramfs "${certs_path}"
log_end_msg 0
;;
stop)
log_daemon_msg "Stopping Octavia Agent RAMDISK" "$NAME"
certs_path=$(awk "/base_cert_dir / {printf \$3}" /etc/octavia/amphora-agent.conf)
umount "${certs_path}"
cryptsetup luksClose /dev/mapper/certfs-ramfs
log_end_msg 0
;;
restart|force-reload)
# Restart the daemon.
$0 stop && sleep 2 && $0 start
;;
*)
# For invalid arguments, print the usage message.
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 2
;;
esac
......@@ -13,7 +13,8 @@ override_dh_clean:
find . -iname '*.pyc' -delete
rm -f AUTHORS
rm -f ChangeLog
rm -f debian/*.init debian/*.service debian/*.upstart
rm -f debian/octavia-agent.octavia-agent.init debian/octavia-api.init debian/octavia-health-manager.init debian/octavia-housekeeping.init debian/octavia-worker.init
rm -f debian/octavia-agent.octavia-agent.service debian/octavia-api.service debian/octavia-health-manager.service debian/octavia-housekeeping.service debian/octavia-worker.service
rm -rf build
rm -rf octavia.sqlite
rm -rf octavia.egg-info
......