-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrestore_original.sh
71 lines (55 loc) · 1.76 KB
/
restore_original.sh
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
#!/bin/bash
# ---------------------------------------------------------------------------- #
# Author: Marco Pappalardo
#
# Mac OS X 10.9 Mavericks - Finder and Trash Icon changer
#
# Usage:
# The script restore the original icons
# ---------------------------------------------------------------------------- #
# Initalization of variables
OS_VERSION=`sw_vers -productVersion`
SOURCE_FOLDER="./originals"
DEST_FOLDER="/System/Library/CoreServices/Dock.app/Contents/Resources"
icons_list=(finder.png [email protected] trashempty.png [email protected] trashfull.png [email protected])
# This method only works for Mavericks, since they have changed the icons name
if [ $OS_VERSION != "10.9" ]; then
echo "The operating system is not 10.9 Mavericks. This script, at the moment, only works for 10.9"
exit 1
fi
if [ ! -d "$SOURCE_FOLDER" ]; then
echo "[X] $SOURCE_FOLDER is missing!"
exit 1
fi
# Checking that all required icons are available
FILE_ERROR=false
for icon in ${icons_list[@]}
do
if [ ! -f $SOURCE_FOLDER/$icon ] ; then
echo "[X] $SOURCE_FOLDER/$icon missing!"
FILE_ERROR=true
fi
done
# Stop the execution here after printing all the errors and doing anything!
if $FILE_ERROR ; then
echo "[-] Please fix the errors before proceeding"
exit 1
fi
# restoring icons
for icon in ${icons_list[@]}
do
cp "$SOURCE_FOLDER/$icon" "$DEST_FOLDER/$icon"
printf "[-] Restoring: %s --> %s \n" "$SOURCE_FOLDER/$icon" "$DEST_FOLDER/$icon"
done
# Giving correct ownership
# for icon in ${icons_list[@]}
# do
# chown root:wheel $DEST_FOLDER/$icon
# printf "[-] chown root:wheel %s \n" "$DEST_FOLDER/$icon"
# done
# Applying modification
echo "---------------------------- "
echo "[-] Restarting Dock and Finder"
killall Finder
killall Dock
echo "[-] All done!"