Skip to content

Commit 29482d7

Browse files
committed
Bring back v-open-fs-config.
1 parent fe931d0 commit 29482d7

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

bin/v-open-fs-config

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
# info: open config
3+
# options: CONFIG
4+
#
5+
# The function opens/reads config files on the file system
6+
7+
src_file=$1
8+
9+
# Checking arguments
10+
if [ -z "$src_file" ]; then
11+
echo "Usage: CONFIG"
12+
exit 1
13+
fi
14+
15+
# Checking hestia user
16+
if [ ! -d "$HESTIA/data/users/$user" ]; then
17+
echo "Error: hestia user $user doesn't exist"
18+
exit 3
19+
fi
20+
21+
# Checking file on fs
22+
if [ ! -e "$src_file" ]; then
23+
echo "Error: $src_file file doesn't exist"
24+
exit 3
25+
fi
26+
27+
# Checking path
28+
if [ ! -z "$src_file" ]; then
29+
rpath=$(readlink -f "$src_file")
30+
services="nginx|apache|httpd|php|ftp|bind|named|exim|dovecot|spamassassin"
31+
services="$services|clam|mysql|postgresql|pgsql|cron|ssh|fail2ban|iptables"
32+
services="$services|my.cnf"
33+
spath=$(echo "$rpath" |egrep "$services")
34+
if [ -z "$spath" ]; then
35+
echo "Error: invalid source path $src_file"
36+
exit 2
37+
fi
38+
spath=$(echo "$rpath" |egrep "/etc|/var/lib")
39+
if [ -z "$spath" ]; then
40+
echo "Error: invalid source path $src_file"
41+
exit 2
42+
fi
43+
fi
44+
45+
# Reading conf
46+
cat "$src_file" 2>/dev/null
47+
if [ $? -ne 0 ]; then
48+
echo "Error: file $src_file was not opened"
49+
exit 3
50+
fi
51+
52+
# Exiting
53+
exit

install/upgrade/versions/latest.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ mv $HESTIA/bin/v-get-fs-file-type $HESTIA_BACKUP/bin/
8686
mv $HESTIA/bin/v-list-fs-directory $HESTIA_BACKUP/bin/
8787
mv $HESTIA/bin/v-move-fs-directory $HESTIA_BACKUP/bin/
8888
mv $HESTIA/bin/v-move-fs-file $HESTIA_BACKUP/bin/
89-
mv $HESTIA/bin/v-open-fs-config $HESTIA_BACKUP/bin/
9089
mv $HESTIA/bin/v-open-fs-file $HESTIA_BACKUP/bin/
9190
mv $HESTIA/bin/v-search-fs-object $HESTIA_BACKUP/bin/
9291
if [ ! -d "$HESTIA_BACKUP/web" ]; then

0 commit comments

Comments
 (0)