Browse Source

remove scripts/uninstall-mmgen.py

The MMGen Project 1 year ago
parent
commit
32593cd205
1 changed files with 0 additions and 93 deletions
  1. 0 93
      scripts/uninstall-mmgen.py

+ 0 - 93
scripts/uninstall-mmgen.py

@@ -1,93 +0,0 @@
-#!/usr/bin/env python3
-#
-# mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution
-# Copyright (C)2013-2023 The MMGen Project <mmgen@tuta.io>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import sys,os
-
-from mmgen import opts
-from mmgen.cfg import gc,Config
-from mmgen.util import msg,die
-
-def normalize_path(p):
-	return os.path.normpath(os.path.realpath(os.path.abspath(p)))
-
-curdir = normalize_path(os.curdir)
-
-for n in reversed(range(len(sys.path))):
-	if normalize_path(sys.path[n]) == curdir:
-		del sys.path[n]
-
-try:
-	import mmgen.main
-except:
-	sys.stderr.write('Failed to import mmgen.main module.  Is MMGen installed?\n')
-	sys.exit(1)
-
-modpath_save = sys.modules['mmgen.main'].__spec__.origin
-
-opts_data = {
-	'text': {
-		'desc': 'Remove MMGen from your system',
-		'usage': '[opts]',
-		'options': """
--h, --help        Print this help message
--l, --list-paths  List the directories and files that would be deleted
--n, --no-prompt   Don't prompt before deleting
-"""
-	}
-}
-
-cfg = Config(opts_data=opts_data)
-
-if gc.platform == 'linux' and os.getenv('USER') != 'root':
-	die(1,'This program must be run as root')
-
-if len(cfg._args):
-	cfg._opts.usage()
-
-mod_dir = os.path.split(normalize_path(modpath_save))[0]
-mod_pardir = os.path.split(mod_dir)[0]
-ull = '/usr/local/lib/'
-ulb = '/usr/local/bin/'
-
-if curdir == mod_dir[:len(curdir)] or mod_dir[:len(ull)] != ull:
-	die(1,"Can't find system install directory! Aborting")
-
-del_list = ['/usr/local/share/mmgen',mod_dir]
-
-import stat
-def is_reg(pn): return stat.S_ISREG(os.stat(pn).st_mode)
-def is_dir(pn): return stat.S_ISDIR(os.stat(pn).st_mode)
-
-for d in (ulb,mod_pardir):
-	# add files only, not directories
-	del_list += [os.path.join(d,e) for e in os.listdir(d) if is_reg(os.path.join(d,e)) and e[:6] == 'mmgen-']
-
-if cfg.list_paths:
-	die(1,'\n'.join(del_list))
-
-if not cfg.no_prompt:
-	m = 'Deleting the following paths and files:\n  {}\nProceed?'
-	from mmgen.ui import keypress_confirm
-	if not keypress_confirm( cfg, m.format('\n  '.join(del_list)) ):
-		die(1,'Exiting at user request')
-
-import shutil
-for pn in del_list:
-	if is_dir(pn): shutil.rmtree(pn)
-	else:          os.unlink(pn)
-	msg('Deleted: ' + pn)