in files/sdw-admin.py [0:0]
def main():
if os.geteuid() == 0:
print("Please do not run this script as root.")
sys.exit(0)
args = parse_args()
if args.validate:
print("Validating...", end="")
validate_config(SCRIPTS_PATH)
print("OK")
elif args.apply:
print(
"SecureDrop Workstation should be installed on a fresh Qubes OS install.\n"
"The installation process will overwrite any user modifications to the\n"
f"{BASE_TEMPLATE} TemplateVM, and will disable old-format qubes-rpc\n"
"policy directives.\n"
)
affected_appvms = get_appvms_for_template(BASE_TEMPLATE)
if len(affected_appvms) > 0:
print(
f"{BASE_TEMPLATE} is already in use by the following AppVMS:\n"
f"{affected_appvms}\n"
"Applications and configurations in use by these AppVMs will be\n"
f"removed from {BASE_TEMPLATE}."
)
response = input("Are you sure you want to proceed (y/N)? ")
if response.lower() != "y":
print("Exiting.")
sys.exit(0)
print("Applying configuration...")
validate_config(SCRIPTS_PATH)
install_pvh_support()
copy_config()
refresh_salt()
provision_all()
elif args.uninstall:
print(
"Uninstalling will remove all packages and destroy all VMs associated\n"
"with SecureDrop Workstation. It will also remove all SecureDrop tags\n"
"from other VMs on the system."
)
if not args.force:
response = input("Are you sure you want to uninstall (y/N)? ")
if response.lower() != "y":
print("Exiting.")
sys.exit(0)
refresh_salt()
perform_uninstall()
else:
sys.exit(0)