mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-27 20:16:22 +02:00
fix sudo file exists
This commit is contained in:
@@ -87,7 +87,7 @@ if sys.argv[1] == "on":
|
|||||||
# generate custom service config
|
# generate custom service config
|
||||||
service_data = SERVICETEMPLATE.replace("[PLACEHOLDER]", additional_parameters)
|
service_data = SERVICETEMPLATE.replace("[PLACEHOLDER]", additional_parameters)
|
||||||
|
|
||||||
# DEBUG exit
|
# debug print out service
|
||||||
print()
|
print()
|
||||||
print("*** New systemd service: %s" % (SERVICENAME))
|
print("*** New systemd service: %s" % (SERVICENAME))
|
||||||
print(service_data)
|
print(service_data)
|
||||||
@@ -101,7 +101,9 @@ if sys.argv[1] == "on":
|
|||||||
# check if SSH keys for root user need to be created
|
# check if SSH keys for root user need to be created
|
||||||
print()
|
print()
|
||||||
print("*** Checking root SSH keys")
|
print("*** Checking root SSH keys")
|
||||||
if Path("/root/.ssh/id_rsa.pub").exists() == False:
|
sshkeys_exist = subprocess.check_output("sudo ls /root/.ssh/id_rsa.pub | grep -c 'id_rsa.pub'", shell=True, universal_newlines=True)
|
||||||
|
print(sshkeys_exist)
|
||||||
|
if str(sshkeys_exist).count("1") == 0:
|
||||||
print("Generating root SSH keys ...")
|
print("Generating root SSH keys ...")
|
||||||
subprocess.call("sudo -u root ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa -q -N \"\"", shell=True)
|
subprocess.call("sudo -u root ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa -q -N \"\"", shell=True)
|
||||||
print("DONE")
|
print("DONE")
|
||||||
|
Reference in New Issue
Block a user