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 () {
fi
# 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"
else
echo "$0: /dev/$dev is not ready to be used as an openslx drive"
......@@ -67,7 +67,8 @@ fi
touch "/home/openslx/usb_slx/$dev"
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
echo "$0: $dev has an empty config file"
exit 3 # stops openslx users_pendrive execution for this dev
......@@ -109,7 +110,7 @@ while (( [ $# -gt 0 ] )); do
if [ -n "$localID" ] && [ -n "$localGID" ]; then
/opt/openslx/scripts/adduser.sh "$passwdf" "$groupf" "$shadowf"
#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"
#if ext4, change owner to new user and create ecrypted
......
......@@ -31,7 +31,7 @@ if ( [ "$user_drive_type" = "vfat" ] ); then
else
#this is a user
#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")
#check if there is something mounted in this user home( $user_name )
#if so, umount it
......@@ -49,7 +49,7 @@ if ( [ "$user_drive_type" = "vfat" ] ); then
#rebind stuff
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
#significatlçy improves speed and leaves the user pendrive without useless files
......@@ -60,5 +60,3 @@ if ( [ "$user_drive_type" = "ext4" ] ); then
echo $0": user drive type is ext4"
#do encryption
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment