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