-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathuninstall_atom.pl
executable file
·112 lines (89 loc) · 2.69 KB
/
uninstall_atom.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr//bin/env perl
=pod
=head1 AUTHOR
nsardo - L<https://www.linkedin.com/in/nicksardo/>
=head1 DESCRIPTION
A quick and dirty script to root out the known file
locations that the Atom editor creates, and delete
them as well as the Atom.app itself.
Basically, an "Uninstall Script" for the Atom Editor.
I should probably note that I knocked this script out
using Atom ;-) lol.
Usage:
(Terminal from within the uninstall_atom folder):
chmod a+x uninstall_atom.pl
./uninstall_atom.pl <your user name>
=cut
use strict;
use warnings;
use 5.010;
use Term::ANSIColor;
my $user_n = "";
$user_n = $ARGV[0];
if ( ! $user_n ) {
print color( 'bold red' );
say "\nUsage: ./uninstall_atom.pl <your user name>\n";
print color( 'reset' );
exit(1);
}
print color( 'bold green' );
say "\n\nchecking for user {$user_n}'s Home directory...";
print color( 'reset' );
if( -e "/Users/$user_n" ) {
print color( 'bold blue' );
say "directory exists, beginning removal of Atom";
print color( 'reset' );
} else {
my $help = <<EOT;
Possibly you mis-spelled your username?
If you're not sure, open a terminal and type in:
whoami
EOT
print color( 'bold red' );
say "\n$help";
print color( 'reset' );
exit(1);
}
#known non-user directories
my @files = qw| /usr/local/bin/atom
/usr/local/bin/apm
/Applications/Atom.app
|;
foreach my $line ( @files ) {
if( -e $line ) {
`rm -rf "$line" `;
print color( 'bold green' );
say "[REMOVED FILE]: $line";
print color( 'reset' );
} else {
print color( 'bold blue' );
say "[FILE NOT PRESENT, MOVING ON]: $line";
print color( 'reset' );
}
}
#known user directory files
my @user_files = (
"/Users/$user_n/.atom",
"/Users/$user_n/Library/Preferences/com.github.atom.plist",
"/Users/$user_n/Library/Application Support/com.github.atom.ShipIt",
"/Users/$user_n/Library/Application Support/Atom",
"/Users/$user_n/Library/Saved Application State/com.github.atom.savedState",
"/Users/$user_n/Library/Caches/com.github.atom",
"/Users/$user_n/Library/Caches/com.github.atom.Shipit",
"/Users/$user_n/Library/Caches/Atom"
);
foreach my $line ( @user_files ) {
if( -e $line ) {
`rm -rf "$line" `;
print color( 'bold green' );
say "[REMOVED FILE]: $line";
print color( 'reset' );
} else {
print color( 'bold blue' );
say "[FILE NOT PRESENT, MOVING ON]: $line";
print color( 'reset' );
}
}
print color( 'bold green' );
say "\nAll known artifacts of Atom have been removed from your system.";
print color('reset');