Skip to content

Commit ad8a39d

Browse files
cmstewLupul
authored andcommitted
Fixes bug where the same user gets added multiple times to the ip file.
1 parent e6c29ad commit ad8a39d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

func/ip.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ increase_ip_value() {
8383
if [ -z "$current_usr" ]; then
8484
new_usr="$USER"
8585
else
86-
check_usr=$(echo -e "${current_usr//,/\n}" |grep -w $USER)
86+
check_usr=$(echo -e "${current_usr//,/\\n}" | grep -w ^${USER}$)
8787
if [ -z "$check_usr" ]; then
8888
new_usr="$current_usr,$USER"
8989
else

install/upgrade/versions/1.3.1.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,15 @@
55
#######################################################################################
66
####### Place additional commands below. #######
77
#######################################################################################
8+
9+
# Remove duplicate values in U_SYS_USERS variable for ips
10+
for ip in $(ls $HESTIA/data/ips/); do
11+
current_usr=$(grep "U_SYS_USERS=" $HESTIA/data/ips/$ip |cut -f 2 -d \')
12+
13+
new_usr=$(echo $current_usr | sed 's/,/\n/g' | sort | uniq | paste -sd,)
14+
15+
if [ ! -z $new_usr ]; then
16+
sed -i "s/U_SYS_USERS='$current_usr'/U_SYS_USERS='$new_usr'/g" $HESTIA/data/ips/$ip
17+
fi
18+
done
19+

0 commit comments

Comments
 (0)