source: lmd/trunk/fuentes/lmd-server.install/usr/sbin/lmd-import-from-admin-center.sh

Last change on this file was 3136, checked in by kbut, 4 years ago

add script to set search domain

  • Property svn:executable set to *
File size: 1.6 KB
Line 
1#!/bin/bash
2
3echo "[lmd Import] Import file from /var/www/exported..."
4
5# Create tmp dir
6if [ -d /tmp/extracted_image ]
7then
8    echo "[lmd Import] Preparing tmp dir..."
9    rm -r /tmp/extracted_image
10fi
11
12mkdir /tmp/extracted_image
13
14#### Ubicar dins la llista d'opcions el que hem creat n4d
15
16echo "[lmd Import] Extracting file... ${1}"
17tar -xvzf /var/www/exported/${1} -C /tmp/extracted_image/
18echo $?
19# Moving
20echo "[lmd Import] Moving files to LTSP folder"
21extracted_image=`ls /tmp/extracted_image/opt/ltsp/*/*.json | cut -d "/" -f 6`
22extracted_filename=`ls /tmp/extracted_image/opt/ltsp/*/*.json | cut -d "/" -f 7`
23new_imagename="${extracted_filename%.*}"
24
25if [ -d /opt/ltsp/${new_imagename} ];
26then
27    echo "[lmd Import] Error. Image Name already exists...! Folder: /opt/ltsp/${new_imagename}"
28    exit -1
29fi
30
31echo "moving /tmp/extracted_image/opt/ltsp/${extracted_image} to /opt/ltsp/${new_imagename}"
32echo "moving /opt/ltsp/${new_imagename}/${extracted_filename} to /etc/ltsp/images/"
33
34mv /tmp/extracted_image/opt/ltsp/${extracted_image}  /opt/ltsp/${new_imagename}
35mv /opt/ltsp/${new_imagename}/${extracted_filename}  /etc/ltsp/images/
36
37echo "Updating kernels..."
38# Update kernels and regenerate image
39ltsp-update-kernels ${new_imagename}
40ltsp-update-sshkeys
41ltsp-update-image ${new_imagename}
42ltsp-set-domain-search-ltsconf
43 
44# Restarting NBD
45"echo Restarting nbd"
46invoke-rc.d nbd-server restart
47
48# Setting image into bootMenu
49#echo "Setting image into bootMenu"
50#n4d-client -c LlxBootManager -m pushToBootList -u ${USER} -p ${PASS} -a ltsp_label${new_imagename}
51
52echo "DONE.."
53exit 0
Note: See TracBrowser for help on using the repository browser.