source: lmd/trunk/fuentes/lmd-server.install/usr/sbin/lmd-promote-image @ 6839

Last change on this file since 6839 was 6839, checked in by kbut, 19 months ago

Add script to promote image

  • Property svn:executable set to *
File size: 894 bytes
Line 
1#!/bin/bash
2
3usage(){
4    echo -e "Usage:"
5    echo -e "$0 IMAGETOPRMOTE" "DESTNAME"
6}
7if [ "$#" -lt 2 ]; then
8    usage
9fi
10
11IMAGETOPRMOTE=${1%/}
12shift
13DESTNAME=${1%/}
14
15# rm /etc/ltsp/images
16[ ! -e "/etc/ltsp/images/${IMAGETOPRMOTE}.json" ] || rm "/etc/ltsp/images/${IMAGETOPRMOTE}.json"
17
18# /etc/nbd-server
19[ ! -e "/etc/nbd-server/conf.d/ltsp_${IMAGETOPRMOTE}.conf" ] || rm "/etc/nbd-server/conf.d/ltsp_${IMAGETOPRMOTE}.conf"
20
21# /opt/ltsp/images
22if [ -e "/opt/ltsp/images/${IMAGETOPRMOTE}.img" ]; then
23    rsync -ax "/opt/ltsp/images/${IMAGETOPRMOTE}.img" "/opt/ltsp/images/${DESTNAME}.img"
24fi
25
26# /var/lib/tftpboot/ltsp
27# Save custom conf from original image
28if [ -e "/var/lib/tftpboot/ltsp/${IMAGETOPRMOTE}/" ]; then
29    rsync -ax --delete --exclude="lts.conf" "/var/lib/tftpboot/ltsp/${IMAGETOPRMOTE}/" "/var/lib/tftpboot/ltsp/${DESTNAME}"
30fi
31# Restart NBD-SERVER
32systemctl restart nbd-server
Note: See TracBrowser for help on using the repository browser.