Fixes and new desktop starter synchronization system.
This commit is contained in:
parent
350f4c2646
commit
4ce97f5486
6 changed files with 27 additions and 17 deletions
|
@ -11,12 +11,15 @@ lmnsynci ALL=(root) NOPASSWD: /usr/local/bin/vm-aria2
|
|||
%role-student ALL=(root) NOPASSWD: /usr/local/bin/vm-link-images
|
||||
%role-teacher ALL=(root) NOPASSWD: /usr/local/bin/vm-link-images
|
||||
|
||||
# start-virtiofsd: Start Virtiofsd as systemd-service
|
||||
%examusers ALL=(root) NOPASSWD: /usr/local/bin/start-virtiofsd
|
||||
%role-student ALL=(root) NOPASSWD: /usr/local/bin/start-virtiofsd
|
||||
%role-teacher ALL=(root) NOPASSWD: /usr/local/bin/start-virtiofsd
|
||||
# vm-virtiofsd: Start Virtiofsd as systemd-service
|
||||
%examusers ALL=(root) NOPASSWD: /usr/local/bin/vm-virtiofsd
|
||||
%role-student ALL=(root) NOPASSWD: /usr/local/bin/vm-virtiofsd
|
||||
%role-teacher ALL=(root) NOPASSWD: /usr/local/bin/vm-virtiofsd
|
||||
|
||||
# sync-vm.sh: sync desktop-starterfiles from server
|
||||
%role-teacher ALL=(lmnsynci) NOPASSWD: /usr/local/bin/sync-vm.sh
|
||||
%role-student ALL=(lmnsynci) NOPASSWD: /usr/local/bin/sync-vm.sh
|
||||
%examusers ALL=(lmnsynci) NOPASSWD: /usr/local/bin/sync-vm.sh
|
||||
# desktop-sync:
|
||||
%examusers ALL=(root) NOPASSWD: /usr/local/bin/desktop-sync
|
||||
%role-student ALL=(root) NOPASSWD: /usr/local/bin/desktop-sync
|
||||
%role-teacher ALL=(root) NOPASSWD: /usr/local/bin/desktop-sync
|
||||
|
||||
# vm-upload:
|
||||
%role-teacher ALL=(lmnsynci) NOPASSWD: /usr/local/bin/vm-upload
|
||||
|
|
|
@ -24,7 +24,10 @@ if [[ "${COMMAND}" = "start" ]]; then
|
|||
--collect \
|
||||
--property=Type=exec \
|
||||
--property=SuccessExitStatus=1 \
|
||||
aria2c --bt-hash-check-seed=true --check-integrity=true --seed-ratio=0.0 --dht-entry-point="${SEEDBOX_HOST}:${SEEDBOX_PORT}" "${VM_SYSDIR}/${VM_NAME}.qcow2.torrent"
|
||||
elif [[ "${COMMAND}" = "stop" ]]; then
|
||||
systemctl stop "aria2-${VM_NAME}.service" || echo "Aria2-Service not running"
|
||||
aria2c --bt-hash-check-seed=true --check-integrity=true --seed-ratio=0.0 \
|
||||
--dht-entry-point="${SEEDBOX_HOST}:${SEEDBOX_PORT}" \
|
||||
--dht-file-path=$DHTDAT \
|
||||
"${VM_SYSDIR}/${VM_NAME}.qcow2.torrent"
|
||||
elif [[ "${COMMAND}" = "stop" ]] && systemctl is-active "aria2-${VM_NAME}.service"; then
|
||||
systemctl stop "aria2-${VM_NAME}.service"
|
||||
fi
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
set -eu
|
||||
|
||||
source /etc/lmn/vm.conf
|
||||
PERSISTENT=0
|
||||
|
||||
while getopts ':p' OPTION; do
|
||||
case "$OPTION" in
|
||||
|
|
|
@ -156,6 +156,7 @@ export XDG_CONFIG_HOME="/tmp/${UID}/.config"
|
|||
|
||||
if ! virsh --connect="${QEMU}" list | grep "${VM_NAME}-clone"; then
|
||||
echo "VM not yet running."
|
||||
sudo /usr/local/bin/desktop-sync
|
||||
check_images
|
||||
if [[ "${NEWCLONE}" = 1 ]] || [[ ! -f "${VM_DIR}/${VM_NAME}-clone.qcow2" ]]; then
|
||||
create_clone "${VM_NAME}"
|
||||
|
|
|
@ -69,7 +69,8 @@ delete_outdated_image() {
|
|||
|
||||
get_file() {
|
||||
cd "${VM_SYSDIR}"
|
||||
wget --no-proxy -O "${FILENAME}" "http://${SEEDBOX_HOST}/aria2/${FILENAME}" || echo "File not found on seedbox"
|
||||
curl --fail --noproxy ${SEEDBOX_HOST} -o "${FILENAME}" \
|
||||
"http://${SEEDBOX_HOST}/aria2/${FILENAME}" || echo "File not found on seedbox"
|
||||
}
|
||||
|
||||
push_file() {
|
||||
|
|
|
@ -150,7 +150,6 @@
|
|||
mode: '0755'
|
||||
loop:
|
||||
- mounthome.sh
|
||||
- sync-vm.sh
|
||||
- vm-create
|
||||
- vm-rebase
|
||||
- vm-run
|
||||
|
@ -161,6 +160,7 @@
|
|||
- virtiofsd
|
||||
- vm-aria2
|
||||
- uploadseed
|
||||
- desktop-sync
|
||||
|
||||
- name: Deploy vm configuration file vm.conf
|
||||
ansible.builtin.copy:
|
||||
|
@ -259,7 +259,8 @@
|
|||
dest: /etc/xdg/menus/applications-merged/
|
||||
notify: Run update-desktop-database
|
||||
|
||||
- name: Sync .torrent, .xml and .desktop files and run update-desktop-database
|
||||
command: sudo -u lmnsynci /usr/local/bin/sync-vm.sh -t
|
||||
register: result
|
||||
changed_when: result.stdout | length > 0
|
||||
- name: Copy initial sync starter
|
||||
ansible.builtin.copy:
|
||||
src: sync.desktop
|
||||
dest: /usr/local/share/applications/
|
||||
notify: Run update-desktop-database
|
||||
|
|
Loading…
Add table
Reference in a new issue