Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
fb723fad
Commit
fb723fad
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Tidying
parent
47f5beb1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/freedombone-app-syncthing
+14
-11
14 additions, 11 deletions
src/freedombone-app-syncthing
src/freedombone-syncthing
+1
-1
1 addition, 1 deletion
src/freedombone-syncthing
with
15 additions
and
12 deletions
src/freedombone-app-syncthing
+
14
−
11
View file @
fb723fad
...
...
@@ -38,6 +38,7 @@ NOT_ON_HOMEPAGE=1
SYNCTHING_ID
=
SYNCTHING_CONFIG_PATH
=
/root/.config/syncthing
SYNCTHING_CONFIG_FILE
=
$SYNCTHING_CONFIG_PATH
/config.xml
SYNCTHING_IDS_FILE
=
~/.syncthingids
SYNCTHING_RELAY_SERVER
=
'https://relays.syncthing.net/endpoint'
SYNCTHING_RELEASES
=
'https://api.github.com/repos/syncthing/syncthing/releases?per_page=30'
SYNCTHING_PORT
=
22000
...
...
@@ -50,8 +51,6 @@ SYNCTHING_DESCRIPTION=$'File synchronization'
SYNCTHING_MOBILE_APP_URL
=
'https://f-droid.org/packages/com.nutomic.syncthingandroid'
syncthing_variables
=(
SYNCTHING_ID
SYNCTHING_CONFIG_PATH
SYNCTHING_CONFIG_FILE
SYNCTHING_RELAY_SERVER
SYNCTHING_RELEASES
SYNCTHING_PORT
...
...
@@ -89,13 +88,13 @@ function syncthing_create_ids_file {
fi
SYNCTHING_ID
=
$(
cat
~/.syncthing-server-id
)
if
[
!
-f
$SYNCTHING_
CONFIG
_FILE
]
;
then
if
[
!
-f
$SYNCTHING_
IDS
_FILE
]
;
then
{
echo
$'# Your syncthing configuration file'
;
echo
'#'
;
echo
$"# The
${
PROJECT_NAME
}
syncthing ID is:
$SYNCTHING_ID
"
;
echo
'#'
;
echo
'# Paste the IDs of your devices below'
;
echo
'#'
;
}
>
$SYNCTHING_
CONFIG
_FILE
echo
'#'
;
}
>
$SYNCTHING_
IDS
_FILE
fi
}
...
...
@@ -104,7 +103,7 @@ function syncthing_manual_edit {
return
fi
syncthing_create_ids_file
editor
$SYNCTHING_
CONFIG
_FILE
editor
$SYNCTHING_
IDS
_FILE
# force an update of the configuration
touch
~/.syncthing-update
...
...
@@ -164,7 +163,7 @@ function syncthing_add_id {
return
fi
if
grep
-q
"
$SYNCTHING_DEVICE_ID
"
$SYNCTHING_
CONFIG
_FILE
;
then
if
grep
-q
"
$SYNCTHING_DEVICE_ID
"
$SYNCTHING_
IDS
_FILE
;
then
dialog
--title
$"Add a Syncthing device ID"
\
--backtitle
$"Freedombone User Control Panel"
\
--msgbox
$"That ID has already been added"
6 50
...
...
@@ -172,9 +171,9 @@ function syncthing_add_id {
fi
if
[
${#
SYNCTHING_DESCRIPTION
}
-gt
0
]
;
then
echo
"#
$SYNCTHING_DESCRIPTION
"
>>
$SYNCTHING_
CONFIG
_FILE
echo
"#
$SYNCTHING_DESCRIPTION
"
>>
$SYNCTHING_
IDS
_FILE
fi
echo
"
$SYNCTHING_DEVICE_ID
"
>>
$SYNCTHING_
CONFIG
_FILE
echo
"
$SYNCTHING_DEVICE_ID
"
>>
$SYNCTHING_
IDS
_FILE
# force an update of the configuration
touch
~/.syncthing-update
...
...
@@ -218,14 +217,14 @@ function syncthing_remove_id {
return
fi
if
!
grep
-q
"
$SYNCTHING_DEVICE_ID
"
$SYNCTHING_
CONFIG
_FILE
;
then
if
!
grep
-q
"
$SYNCTHING_DEVICE_ID
"
$SYNCTHING_
IDS
_FILE
;
then
dialog
--title
$"Remove a Syncthing device ID"
\
--backtitle
$"Freedombone User Control Panel"
\
--msgbox
$"That ID wasn't registered anyway"
6 50
return
fi
sed
-i
"/
$SYNCTHING_DEVICE_ID
/d"
$SYNCTHING_
CONFIG
_FILE
sed
-i
"/
$SYNCTHING_DEVICE_ID
/d"
$SYNCTHING_
IDS
_FILE
# force an update of the configuration
touch
~/.syncthing-update
...
...
@@ -236,7 +235,7 @@ function syncthing_remove_id {
}
function
run_client_syncthing
{
SYNCTHING_
CONFIG
_FILE
=
~/.syncthingids
SYNCTHING_
IDS
_FILE
=
~/.syncthingids
SYNCTHING_ID
=
$(
cat
~/.syncthing-server-id
)
W
=(
1
$"Show device ID for
${
PROJECT_NAME
}
"
...
...
@@ -452,6 +451,10 @@ function remove_syncthing {
remove_completion_param configure_firewall_for_syncthing
systemctl restart cron
if
[
-f
$SYNCTHING_IDS_FILE
]
;
then
rm
$SYNCTHING_IDS_FILE
fi
for
d
in
/home/
*
/
;
do
USERNAME
=
$(
echo
"
$d
"
|
awk
-F
'/'
'{print $3}'
)
if
[
-d
"/home/
$USERNAME
/.config/syncthing"
]
;
then
...
...
This diff is collapsed.
Click to expand it.
src/freedombone-syncthing
+
1
−
1
View file @
fb723fad
...
...
@@ -281,7 +281,7 @@ function user_devices_changed {
if
[
-f
"/home/
$USERNAME
/
$SYNCTHING_UPDATE_FILE
"
]
;
then
CHANGED
=
1
fi
x
if
[
-f
"/home/
$USERNAME
/
$SYNCTHING_USER_IDS_FILE
"
]
;
then
while
read
-r
line
||
[[
-n
"
$line
"
]]
;
do
if
[[
$line
!=
*
"#"
*
&&
$line
!=
*
"*"
*
&&
$line
!=
*
'/'
*
&&
$line
==
*
"-"
*
]]
;
then
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment