Fixed bugs with config and syncing w/o files

This commit is contained in:
2021-11-04 23:02:59 -04:00
parent c1da61bee5
commit aa9dd11793
3 changed files with 23 additions and 15 deletions
+9 -5
View File
@@ -7,8 +7,6 @@
# TODO Add dry run support
# TODO use partition command instead of split for separating paths
# TODO use classes!
# Long-er Term Targets:
# TODO
# sshync 2021.11.04.unreleased4
# sshync was created to solve a problem with rpass/sshyp, and as such, sshync will be bundled with sshyp until it is
@@ -111,7 +109,10 @@ def time_sort(old_names, new_names, old_times):
new_pos += 1
if title in old_names:
old_pos = old_names.index(title)
remote_mod_times_new.append(old_times[old_pos])
try:
remote_mod_times_new.append(old_times[old_pos])
except IndexError:
pass
return remote_mod_times_new
@@ -139,8 +140,11 @@ def run_profile(profile_dir):
'/var/lib/sshyp/sshyncdatabase_times')
remote_mod_times = []
remote_mod_names, remote_mod_times_temp = get_file_paths_mod_remote('/var/lib/sshyp/sshyp.sshync')
for time in remote_mod_times_temp: # remove quotes from remote_mod_times
remote_mod_times.append(float(time))
try:
for time in remote_mod_times_temp: # remove quotes from remote_mod_times
remote_mod_times.append(float(time))
except ValueError:
pass
lmod_short = []
rmod_short = []
matching_names = []
+8 -9
View File
@@ -139,13 +139,15 @@ if argument == 'show c':
if argument == 'config':
try:
print()
devicetype = str(input('Will this be a client, server, or offline device? (C/s/o) '))
devicetype = str(input('Will this be a client or a server device? (C/s) '))
if devicetype == 's' or devicetype == 'S':
open("/var/lib/sshyp/sshyp-device", 'w').write(devicetype)
print('\nMake sure the ssh service is running and properly configured.\n')
copy('/usr/bin/sshync.py', '/home/' + environ.get('USER') + '/')
term('mkdir -p /home/' + environ.get('USER') + '/.password-pasture')
print('Configuration complete!\n')
else:
devicetype = 'c'
gpgid = ''
print()
gpgpresent = str(input(
@@ -172,11 +174,6 @@ if argument == 'config':
pass
term('gpg -r ' + str(gpgid) + ' -e ' + '/var/lib/sshyp/lock')
remove('/var/lib/sshyp/lock')
if devicetype == 'o' or devicetype == 'O':
open("/var/lib/sshyp/sshyp-device", 'w').write(devicetype)
print('\nConfiguration complete!\n')
elif devicetype != 's' and devicetype != 'S':
devicetype = 'c'
print('\nMake sure the ssh service on the remote server is running and properly configured.\n')
sshgen = str(input('rsync support requires a unique ssh key. Would you like to have this '
'automatically generated? (Y/n) '))
@@ -206,6 +203,7 @@ if argument == '':
# import userdata
devicetype = 'c'
try:
devicetype = open('/var/lib/sshyp/sshyp-device').read().strip()
gpgid = open('/var/lib/sshyp/sshyp-gpg').read().strip()
@@ -217,9 +215,10 @@ try:
directoryssh = sshinfo[4].replace('\n', '')
term('mkdir -p ' + directory)
except FileNotFoundError:
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
print("Not all necessary configuration files are present. Please run 'sshyp config'!")
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
if devicetype != 's' and devicetype != 'S':
print('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
print("Not all necessary configuration files are present. Please run 'sshyp config'!")
print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n')
devicetype, sshinfo, directory, directoryssh, ip, port, usernamessh = [0, 0, 0, 0, 0, 0, 0]
exit()
+6 -1
View File
@@ -14,9 +14,14 @@ New features:
Changes:
- branding has been updated to reflect new project name and goals
- custom directories and ssh keys are removed (may be temporary)
- custom directories, custom ssh keys, and offline only mode are removed (may be temporary)
- server installation makes copy of sshync.py in home directory
Bugs to fix!!::
*error when syncing with no files in remote directory
*config warning not disappearing when using server config
*directory not generating with server config
Planned for next update (The Fluffy Update):
- modularized and optimized code