Skip to content
Snippets Groups Projects
Commit 02440b16 authored by Thiago Abdo's avatar Thiago Abdo
Browse files

Merge branch 'develop' of gitlab.c3sl.ufpr.br:cdn/tm-scripts into develop

parents 393fab04 e1fa345d
No related branches found
No related tags found
No related merge requests found
Showing
with 153 additions and 10 deletions
...@@ -12,3 +12,27 @@ test ...@@ -12,3 +12,27 @@ test
logs/ logs/
server/local_builds/ server/local_builds/
/config /config
remote/modules/systemd/dltmp.systemd-204.tar.xz
scripts/home/
stage4/
useful/ainda-nao-sei-usar-o-git.tar.gz
useful/ainda-nao-sei-usar-o-git/
useful/stg312-dummy/
useful/stg312/clone_stage4-dummy.sh
useful/stg312/cloner.desktop
useful/stg312/comeca_tudo_as_coisa.sh
useful/stg312/compactor.sh
useful/stg312/cookie
useful/stg312/dependencies.txt
useful/stg312/mudancas.txt
useful/stg312/po/
useful/stg312/stage4-cloner-doc.odt
useful/stg312/stage4_cloner
useful/stg312/transl-test.txt
useful/stg312/upload
useful/stg312/user_data.info
useful/stg4cloner/cloner.desktop
useful/unused/
/server/configs/enris/
/server/modules/image-creator/
File deleted
#!/bin/bash #!/bin/bash
username=$1 username=$1
password=$2 password=$2
path="$3" path=$3
sigpath=$(printf "%s%s.sig" "$path" "$username") user_home="$path/$username"
ecryptfs_path="$path/.ecryptfs"
user_ecrypt_path="$ecryptfs_path/$username"
if [ ! -d "$ecryptfs_path" ]; then
mkdir $ecryptfs_path
fi
mkdir -p $user_ecrypt_path
mkdir -m 700 "$user_ecrypt_path/.ecryptfs"
mkdir -m 700 "$user_ecrypt_path/.Private"
touch "$user_ecrypt_path/.ecryptfs/auto-mount"
touch "$user_ecrypt_path/.ecryptfs/auto-umount"
echo "/home/$username" > "$user_ecrypt_path/.ecryptfs/Private.mnt"
sigpath="$user_ecrypt_path/.ecryptfs/Private.sig"
wrapped="$user_ecrypt_path/.ecryptfs/wrapped-passphrase"
mountpass=$(openssl rand -base64 32) mountpass=$(openssl rand -base64 32)
printf "%s\n%s" "$mountpass" "$password" | ecryptfs-wrap-passphrase "${path}${username}" printf "%s\n%s" "$mountpass" "$password" | ecryptfs-wrap-passphrase "$wrapped"
printf "%s" "$password" | ecryptfs-insert-wrapped-passphrase-into-keyring "${path}${username}" printf "%s" "$password" | ecryptfs-insert-wrapped-passphrase-into-keyring "$wrapped"
response=`printf "%s" "$mountpass" | ecryptfs-add-passphrase --fnek -` response=`printf "%s" "$mountpass" | ecryptfs-add-passphrase --fnek -`
sig=`echo "$response" | grep "Inserted auth tok" | sed "s/^.*\[//" | sed "s/\].*$//"` sig=`echo "$response" | grep "Inserted auth tok" | sed "s/^.*\[//" | sed "s/\].*$//"`
echo "$sig" > "$sigpath" echo "$sig" > "$sigpath"
chmod 600 "$user_ecrypt_path/.ecryptfs/Private.sig"
chmod 600 "$user_ecrypt_path/.ecryptfs/Private.mnt"
chmod 600 "$user_ecrypt_path/.ecryptfs/wrapped-passphrase"
chmod 644 "$user_ecrypt_path/.ecryptfs/auto-mount"
chmod 644 "$user_ecrypt_path/.ecryptfs/auto-umount"
keyctl clear @u keyctl clear @u
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
exec 1<&- exec 1<&-
exec 2<&- exec 2<&-
exec 1<>/root/ecrypt exec 1<>/var/log/ecrypt
exec 2>&1 exec 2>&1
# check if the /home partition exists # check if the /home partition exists
......
...@@ -6,4 +6,4 @@ ...@@ -6,4 +6,4 @@
# #
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/sbin:/opt/openslx/bin" export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/sbin:/opt/openslx/bin"
/opt/openslx/scripts/local-accounts_mount-home.sh >> /root/mountlog 2>&1 /opt/openslx/scripts/local-accounts_mount-home.sh >> /var/log/mountlog 2>&1
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#if vfat, umount and remount everything with the users that is logging #if vfat, umount and remount everything with the users that is logging
#set -x #set -x
#echo $USER > /root/logfile #echo $USER > /var/log/logfile
if ( [ ! -e /home/openslx/usb_users/$USER ] ); then if ( [ ! -e /home/openslx/usb_users/$USER ] ); then
exit 0; exit 0;
......
...@@ -4,7 +4,7 @@ remove (){ ...@@ -4,7 +4,7 @@ remove (){
#exec 1<&- #exec 1<&-
#exec 2<&- #exec 2<&-
#exec 1<>/root/log #exec 1<>/var/log/local-accounts
#exec 2>&1 #exec 2>&1
#set -x #set -x
...@@ -20,11 +20,12 @@ remove (){ ...@@ -20,11 +20,12 @@ remove (){
fi fi
#umount everything #umount everything
IFS_bckp=$IFS
IFS=$'\n' IFS=$'\n'
for i in $(mount | grep $user_drive | sed 's/ type.*//' | cut -d' ' -f3); do for i in $(mount | grep $user_drive | sed 's/ type.*//' | cut -d' ' -f3); do
umount -f -l $i umount -f -l $i
done done
unset IFS IFS=$IFS_bckp
##Rebuild passwd,shadow,group ##Rebuild passwd,shadow,group
rm -rf /home/openslx/usb_users/* rm -rf /home/openslx/usb_users/*
......
#!/bin/sh #!/bin/sh
/opt/openslx/scripts/local-accounts_insert-data.sh $1 >> /root/local-accounts_insert-data.log & /opt/openslx/scripts/local-accounts_insert-data.sh $1 >> /var/log/local-accounts_insert-data.log &
exit exit
{"login":"root","name":"MEGA ROOT","email":"root@root.com","city":null,"status":"ok","msg":"Get informations of user successful","code":"002"}
\ No newline at end of file
{"status":"ok","code":"001","msg":"Login successful"}
\ No newline at end of file
Nothing to see here, move along now
\ No newline at end of file
s
1727784 testando-linha-de-comando-4.r1.tar.gz
Ping: 2.781 ms
Download: 48.69 Mbyte/s
Upload: 18.60 Mbyte/s
{"uploadid":"dqjl1SbOqGCRIVYorSppGBme18HGNzEfS3R","status":"ok","code":"003","msg":"New upload succesful"}
\ No newline at end of file
{"status":"ok","code":"004","msg":"Upload successful, sending to taskmanager"}
\ No newline at end of file
#!/bin/bash
#$1 é o caminho para o tm-scripts, $2 é a pasta selecionada pelo usuario, $3 é "local", $4 é a pasta onde será clonado o stage 4, $5 é o nome da imagem, $6 é se a pasta não compactada deve ser removida ou não
#pwd
#./loading_screen_openslx &
mkdir -p $2
echo criou o dir
caminho=$(pwd)
echo $1
echo $2
echo $3
echo $4
cp user_data.info "$2"
cd $1
space=$(df --total --output=avail $2 | tail -n 1)
desired=8000000
#echo "$desired -gt $space $2 "
if [[ $desired -gt $space ]]; then
echo "Espaço insuficiente para clonar no local desejado. Tenha certeza que pelo menos 8 Gigas de espaço estão disponiveis."
else
#echo $4 caminho que será executado
if ./clone_stage4 $3 "$4" ; then
cd $caminho
#echo Caminho novo
#pwd
echo s > .result.out
#echo Escreveu
#cat .result.out
echo "Sucesso ao clonar."
if mksquashfs "$4" "$5" -b 1M ; then
mv "$5" "$2"
if [ $6 == "1" ]; then
rm -rf "$4"
fi
cd "$2"
/root/dnbd3/build/dnbd3-server --crc "$5"
tar cvzf "$5".tar.gz user_data.info "$5" "$5".crc
split --verbose -n $7 "$5".tar.gz "$5".tar.gz.
du "$5".tar.gz > .size.out
mv .size.out "$caminho"
cd "$caminho"
#echo Caminho novo
#pwd
echo s > .result.out
#echo Escreveu
#cat .result.out
echo "Sucesso ao compactar"
else
cd "$caminho"
#echo Caminho novo
#pwd
echo n > .result.out
#echo Escreveu
#cat .result.out
echo "Falha ao compactar."
fi
else
#echo $caminho
cd $caminho
#echo Caminho novo
#pwd
echo n > .result.out
#echo Escreveu
#cat .result.out
echo "Nao clonou."
fi
fi
#killall -e loading_screen_openslx
File added
NAME=stage4_cloner NAME=openslx_gui
CFLAGS=-g -Wall -fdiagnostics-show-option -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -o $(NAME) CFLAGS=-g -Wall -fdiagnostics-show-option
GTKFLAGS=-export-dynamic `pkg-config --cflags --libs gtk+-2.0` GTKFLAGS=-export-dynamic `pkg-config --cflags --libs gtk+-3.0 jansson` -lX11 -lcurl
SRCS=stage4_cloner.c SRCS=openslx_gui.c stg4.c utils.c
CC=gcc CC=gcc
# top-level rule to create the program. # top-level rule to create the program.
...@@ -9,7 +9,8 @@ all: main ...@@ -9,7 +9,8 @@ all: main
# compiling the source file. # compiling the source file.
main: $(SRCS) main: $(SRCS)
$(CC) $(CFLAGS) $(SRCS) $(GTKFLAGS) $(CC) $(CFLAGS) -o $(NAME) $(SRCS) $(GTKFLAGS)
$(CC) $(CFLAGS) -o upload upload.c $(GTKFLAGS)
# cleaning everything that can be automatically recreated with "make". # cleaning everything that can be automatically recreated with "make".
clean: clean:
......
useful/stg312/openslx-logo.png

8.08 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment