Skip to content
Snippets Groups Projects
Commit b0bbb9cf authored by Victor Mocelin's avatar Victor Mocelin
Browse files

Updated local-accounts to new folder organization

There is one config for each user now.
Get all configs with a find and join it in one variable, after that it's all the same as before.
parent 9b522246
No related branches found
No related tags found
1 merge request!10Issue/3535
...@@ -41,7 +41,7 @@ prepare_usb () { ...@@ -41,7 +41,7 @@ prepare_usb () {
fi fi
# checks if usb has an openslx config # checks if usb has an openslx config
if [ -e "$mountpath/Openslx/.config" ]; then if [ -n "$(find $mountpath/Openslx/ -maxdepth 2 -iname .config)" ]; then
echo "$0: /dev/$dev is an openslx ready drive" echo "$0: /dev/$dev is an openslx ready drive"
else else
echo "$0: /dev/$dev is not ready to be used as an openslx drive" echo "$0: /dev/$dev is not ready to be used as an openslx drive"
...@@ -67,7 +67,8 @@ fi ...@@ -67,7 +67,8 @@ fi
touch "/home/openslx/usb_slx/$dev" touch "/home/openslx/usb_slx/$dev"
unset IFS unset IFS
users=$(cat "$mountpath/Openslx/.config"); users=$(for i in $(find "$mountpath/Openslx" -iname .config); do cat $i; done)
#users=$(cat "$mountpath/Openslx/.config");
if [ -z "$users" ]; then if [ -z "$users" ]; then
echo "$0: $dev has an empty config file" echo "$0: $dev has an empty config file"
exit 3 # stops openslx users_pendrive execution for this dev exit 3 # stops openslx users_pendrive execution for this dev
...@@ -109,7 +110,7 @@ while (( [ $# -gt 0 ] )); do ...@@ -109,7 +110,7 @@ while (( [ $# -gt 0 ] )); do
if [ -n "$localID" ] && [ -n "$localGID" ]; then if [ -n "$localID" ] && [ -n "$localGID" ]; then
/opt/openslx/scripts/adduser.sh "$passwdf" "$groupf" "$shadowf" /opt/openslx/scripts/adduser.sh "$passwdf" "$groupf" "$shadowf"
#Add to a file what pendrive this user is from #Add to a file what pendrive this user is from
mount --bind $mountpath/Openslx/$username /home/$username mount --bind $mountpath/Openslx/$username/home /home/$username
echo "/dev/$dev" > "/home/openslx/usb_users/$username" echo "/dev/$dev" > "/home/openslx/usb_users/$username"
#if ext4, change owner to new user and create ecrypted #if ext4, change owner to new user and create ecrypted
......
...@@ -31,7 +31,7 @@ if ( [ "$user_drive_type" = "vfat" ] ); then ...@@ -31,7 +31,7 @@ if ( [ "$user_drive_type" = "vfat" ] ); then
else else
#this is a user #this is a user
#save user_names that are mounted to make binding easier after #save user_names that are mounted to make binding easier after
user_name=$(echo $i | cut -d' ' -f4 | rev | cut -d'/' -f1 | rev ) user_name=$(echo $i | cut -d' ' -f4 | rev | cut -d'/' -f2 | rev )
users=$(echo "$users $user_name") users=$(echo "$users $user_name")
#check if there is something mounted in this user home( $user_name ) #check if there is something mounted in this user home( $user_name )
#if so, umount it #if so, umount it
...@@ -49,7 +49,7 @@ if ( [ "$user_drive_type" = "vfat" ] ); then ...@@ -49,7 +49,7 @@ if ( [ "$user_drive_type" = "vfat" ] ); then
#rebind stuff #rebind stuff
for i in $users; do for i in $users; do
mount --bind ${drive_mount_point}/Openslx/$i /home/$i mount --bind ${drive_mount_point}/Openslx/$i/home /home/$i
done done
#significatlçy improves speed and leaves the user pendrive without useless files #significatlçy improves speed and leaves the user pendrive without useless files
...@@ -60,5 +60,3 @@ if ( [ "$user_drive_type" = "ext4" ] ); then ...@@ -60,5 +60,3 @@ if ( [ "$user_drive_type" = "ext4" ] ); then
echo $0": user drive type is ext4" echo $0": user drive type is ext4"
#do encryption #do encryption
fi fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment