some fixed paths for centos

This commit is contained in:
nativemad 2018-11-13 18:23:44 +01:00
parent 7d43ab1428
commit a8353787ed
3 changed files with 5 additions and 4 deletions

7
nlvmi
View File

@ -12,7 +12,6 @@ if [ $U != "root" ]; then
if [ ! -z $3 ]; then C=$3; else C="bla"; fi if [ ! -z $3 ]; then C=$3; else C="bla"; fi
/usr/bin/wrap-nlvmi $A $B $C && exit /usr/bin/wrap-nlvmi $A $B $C && exit
fi fi
if [ ! -d $RUNDIRECTORY ]; then if [ $LOGLEVEL -gt "1" ]; then echo "creating $RUNDIRECTORY"; fi; mkdir -p $RUNDIRECTORY; chown root:nlvmi -R $RUNDIRECTORY; chmod g+w $RUNDIRECTORY; fi if [ ! -d $RUNDIRECTORY ]; then if [ $LOGLEVEL -gt "1" ]; then echo "creating $RUNDIRECTORY"; fi; mkdir -p $RUNDIRECTORY; chown root:nlvmi -R $RUNDIRECTORY; chmod g+w $RUNDIRECTORY; fi
#checking database #checking database
@ -163,7 +162,7 @@ function vmstart {
if [ ! -z ${array[19]} ]; then CDROM="-cdrom ${array[19]}"; fi if [ ! -z ${array[19]} ]; then CDROM="-cdrom ${array[19]}"; fi
if [ ! -z ${array[20]} ]; then TAPDEV1="-netdev tap,ifname=${array[20]},script=no,id=net0"; echo "which tunctl && tunctl -t ${array[20]} -u ${array[2]} >/dev/null || ip tuntap add ${array[20]} mode tap user ${array[2]}; ifconfig ${array[20]} up" >>$TMPF; fi if [ ! -z ${array[20]} ]; then TAPDEV1="-netdev tap,ifname=${array[20]},script=no,id=net0"; echo "which tunctl && tunctl -t ${array[20]} -u ${array[2]} >/dev/null || ip tuntap add ${array[20]} mode tap user ${array[2]}; ifconfig ${array[20]} up" >>$TMPF; fi
if [ ! -z ${array[21]} ]; then MACADDR1="-net nic,macaddr=${array[21]},model=virtio,netdev=net0"; fi if [ ! -z ${array[21]} ]; then MACADDR1="-net nic,macaddr=${array[21]},model=virtio,netdev=net0"; fi
if [ ! -z ${array[22]} ]; then BRDEV1="${array[22]}"; echo "if [ -L /sys/devices/virtual/net/${array[20]}/master ]; then OLDBR=\`readlink -f /sys/devices/virtual/net/${array[20]}/master | rev | cut -d "/" -f1 | rev\`; brctl delif \$OLDBR ${array[20]}; fi; /sbin/brctl addif ${array[22]} ${array[20]} >/dev/null" >>$TMPF; fi if [ ! -z ${array[22]} ]; then BRDEV1="${array[22]}"; TAPDS1=`echo ${array[20]} | cut -c 1-15`; echo "if [ -L /sys/devices/virtual/net/${TAPDS1}/master ]; then OLDBR=\`readlink -f /sys/devices/virtual/net/${TAPDS1}/master | rev | cut -d "/" -f1 | rev\`; brctl delif \$OLDBR ${array[20]}; fi; /sbin/brctl addif ${array[22]} ${array[20]} >/dev/null" >>$TMPF; fi
if [ ! -z ${array[23]} ]; then TAPDEV2="-netdev tap,ifname=${array[23]},script=no,id=net1"; echo "which tunctl && tunctl -t ${array[23]} -u ${array[2]} >/dev/null || ip tuntap add ${array[23]} mode tap user ${array[2]}; ifconfig ${array[23]} up" >>$TMPF; fi if [ ! -z ${array[23]} ]; then TAPDEV2="-netdev tap,ifname=${array[23]},script=no,id=net1"; echo "which tunctl && tunctl -t ${array[23]} -u ${array[2]} >/dev/null || ip tuntap add ${array[23]} mode tap user ${array[2]}; ifconfig ${array[23]} up" >>$TMPF; fi
if [ ! -z ${array[24]} ]; then MACADDR2="-net nic,macaddr=${array[24]},model=virtio,netdev=net1"; fi if [ ! -z ${array[24]} ]; then MACADDR2="-net nic,macaddr=${array[24]},model=virtio,netdev=net1"; fi
if [ ! -z ${array[25]} ]; then BRDEV2="${array[25]}"; echo "if [ -L /sys/devices/virtual/net/${array[23]}/master ]; then OLDBR=\`readlink -f /sys/devices/virtual/net/${array[23]}/master | rev | cut -d "/" -f1 | rev\`; brctl delif \$OLDBR ${array[23]}; fi; /sbin/brctl addif ${array[25]} ${array[23]} >/dev/null" >>$TMPF; fi if [ ! -z ${array[25]} ]; then BRDEV2="${array[25]}"; echo "if [ -L /sys/devices/virtual/net/${array[23]}/master ]; then OLDBR=\`readlink -f /sys/devices/virtual/net/${array[23]}/master | rev | cut -d "/" -f1 | rev\`; brctl delif \$OLDBR ${array[23]}; fi; /sbin/brctl addif ${array[25]} ${array[23]} >/dev/null" >>$TMPF; fi
@ -173,7 +172,8 @@ function vmstart {
if [ ! -z ${array[30]} ]; then WPORT=$((${array[30]} + 5700)); WEBSOCK=",websocket=$WPORT"; else WEBSOCK=""; fi if [ ! -z ${array[30]} ]; then WPORT=$((${array[30]} + 5700)); WEBSOCK=",websocket=$WPORT"; else WEBSOCK=""; fi
if [ ! -z ${array[31]} ]; then VNCPASS=",password"; fi if [ ! -z ${array[31]} ]; then VNCPASS=",password"; fi
if [ ! -z ${array[29]} ]; then VNCPORT="-vnc :${array[29]}$WEBSOCK$VNCPASS"; fi if [ ! -z ${array[29]} ]; then VNCPORT="-vnc :${array[29]}$WEBSOCK$VNCPASS"; fi
COMMAND=(su - ${array[2]} -s /bin/bash -c \"${array[4]} -name ${array[1]} -enable-kvm ${array[10]} $CPUTYPE $MEMORY $SMP -device virtio-rng-pci -boot ${array[11]} $USBDEV $KB -daemonize $DRIVE1$FORMAT1 $DRIVE2$FORMAT2 $DRIVE3$FORMAT3 $CDROM $MACADDR1 $TAPDEV1 $MACADDR2 $TAPDEV2 $MACADDR3 $TAPDEV3 $VNCPORT $CUSTOM -pidfile $RUNDIRECTORY/${array[1]}.pid -monitor unix:$RUNDIRECTORY/${array[1]}.mon,server,nowait\") echo "which ${array[4]} && QEMUCONNAMD=${array[4]} || QEMUCOMMAND=/usr/libexec/qemu-kvm" >>$TMPF
COMMAND=(su - ${array[2]} -s /bin/bash -c \"\$QEMUCOMMAND -name ${array[1]} -enable-kvm ${array[10]} $CPUTYPE $MEMORY $SMP -device virtio-rng-pci -boot ${array[11]} $USBDEV $KB -daemonize $DRIVE1$FORMAT1 $DRIVE2$FORMAT2 $DRIVE3$FORMAT3 $CDROM $MACADDR1 $TAPDEV1 $MACADDR2 $TAPDEV2 $MACADDR3 $TAPDEV3 $VNCPORT $CUSTOM -pidfile $RUNDIRECTORY/${array[1]}.pid -monitor unix:$RUNDIRECTORY/${array[1]}.mon,server,nowait\")
if [ $LOGLEVEL -gt "1" ]; then echo ${COMMAND[@]}; fi if [ $LOGLEVEL -gt "1" ]; then echo ${COMMAND[@]}; fi
echo "${COMMAND[@]}" >>$TMPF echo "${COMMAND[@]}" >>$TMPF
#Set VNC Password #Set VNC Password
@ -350,6 +350,7 @@ if [ $# -gt 0 ]; then
if [ ! -z $MASTERSERVER ]; then if [ ! -z $MASTERSERVER ]; then
if `echo $SSH_CLIENT | grep "$MASTERSERVER " &>/dev/null`; then if `echo $SSH_CLIENT | grep "$MASTERSERVER " &>/dev/null`; then
if [ -e $2 ]; then if [ -e $2 ]; then
source /etc/profile
openssl dgst -sha512 -verify <(openssl x509 -in "/etc/nlvmi/nlvmi_sign.crt" -pubkey -noout) -signature $2.sha512 $2 >/dev/null && /bin/bash $2 || echo "signature failed!!" openssl dgst -sha512 -verify <(openssl x509 -in "/etc/nlvmi/nlvmi_sign.crt" -pubkey -noout) -signature $2.sha512 $2 >/dev/null && /bin/bash $2 || echo "signature failed!!"
fi fi
else else

Binary file not shown.

View File

@ -683,7 +683,7 @@ if (isset($_SESSION['username'])){
echo "<a href=# onclick=\"post('?', {'$button': '$row[vmname]'});\"class=\"btn $buttonc\">$button</a> "; echo "<a href=# onclick=\"post('?', {'$button': '$row[vmname]'});\"class=\"btn $buttonc\">$button</a> ";
echo "<button class=\"btn btn-danger\" data-delete-text=\"Delete VM $row[vmname]!\" data-delete-id=\"$row[id]\" data-delete-name=\"$row[vmname]\" data-toggle=\"modal\" data-target=\"#confirm-delete\" data-delete-what=vm>Delete VM</button> "; echo "<button class=\"btn btn-danger\" data-delete-text=\"Delete VM $row[vmname]!\" data-delete-id=\"$row[id]\" data-delete-name=\"$row[vmname]\" data-toggle=\"modal\" data-target=\"#confirm-delete\" data-delete-what=vm>Delete VM</button> ";
if ($row['websocket']!=""){ if ($row['websocket']!=""){
$server = $_SERVER['HTTP_HOST']; $server = $row['server'];
$websocketport = $row['websocket'] + 5700; $websocketport = $row['websocket'] + 5700;
$wpath=""; $wpath="";
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])){ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])){