Skip to content

Commit 565206c

Browse files
committed
detect archive and offer auto import
1 parent 939caa1 commit 565206c

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

lib/include/settings.sh

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,32 @@ function create_settings() {
6767
fi
6868
local i
6969
log "FileError: '$current_settings_file' not found"
70+
71+
if [ -d archive ]
72+
then
73+
read -p "Exported archive found in current directoy. Do you want to import it? [y/N]" -n 1 -r
74+
echo ""
75+
if [[ $REPLY =~ ^[Yy]$ ]]
76+
then
77+
mkdir -p lib/plugins
78+
if [ ! -d lib/plugins/server-plugin-export ]
79+
then
80+
git clone https://github.com/DDNetPP/server-plugin-export lib/plugins/server-plugin-export
81+
else
82+
pushd lib/plugins/server-plugin-export
83+
git_save_pull
84+
popd
85+
fi
86+
./lib/plugins/server-plugin-export/bin/archive_cli import
87+
fi
88+
if [ -f $current_settings_file ];
89+
then
90+
return
91+
fi
92+
fi
93+
7094
read -p "Do you want to create one? [y/N]" -n 1 -r
71-
echo
95+
echo ""
7296
if [[ $REPLY =~ ^[Yy]$ ]]
7397
then
7498
{

lib/lib.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ source lib/include/port.sh
1414
source lib/include/dir.sh
1515
source lib/include/sid.sh
1616
source lib/include/deps.sh
17-
source lib/include/settings.sh
1817
source lib/include/git.sh
18+
source lib/include/settings.sh
1919
source lib/include/logs.sh
2020
source lib/include/screen.sh
2121
source lib/include/audit_code.sh

0 commit comments

Comments
 (0)