-
Notifications
You must be signed in to change notification settings - Fork 9
/
duplicate_cleaner_scan.sh
59 lines (49 loc) · 1.78 KB
/
duplicate_cleaner_scan.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
#!/bin/bash
# Copyright (C) 2014 by Andrew Ziem. All rights reserved.
# License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
# This is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.
#
# Some material from the Automatic Build System Setup for Chakra (GPLv3+)
# Some material from makepkg (GPLv2+)
#
# Helps automate finding duplicate cleaners in the bleachbit repositories via FSlint.
# To use, you will need: bash, git, and fslint installed.
#
#
# Workspace name (safe to change so long as it's a unique name; this
# directory gets deleted if it already exists.)
WORKSPACENAME="duplicate-scan-workspace"
# Directory variables
CURDIR="${PWD}"
WORKSPACE="${CURDIR}/${WORKSPACENAME}"
# Formatted output functions
msg() {
local mesg=$1; shift
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
msg2() {
local mesg=$1; shift
printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
# Delete old workspace if one exists
if [ -d "${WORKSPACE}" ]; then
msg "Deleting old workspace..."
# Delete write-protected .git files
for i in bleachbit cleanerml
do
sudo rm "${WORKSPACE}"/$i/.git/objects/pack/pack-*.idx
sudo rm "${WORKSPACE}"/$i/.git/objects/pack/pack-*.pack
done
# Delete regular files
rm -rd "${WORKSPACE}"
fi
# Create a new workspace
msg "Creating new workspace..."
msg2 "Cloning az0/bleachbit..."
git clone https://github.com/az0/bleachbit.git "${WORKSPACE}"/bleachbit
msg2 "Cloning az0/cleanerml..."
git clone https://github.com/az0/cleanerml.git "${WORKSPACE}"/cleanerml
# Launch fslint targeting the workspace while hiding standard output
msg "Launching FSlint..."
fslint-gui "${WORKSPACE}" > /dev/null 2>&1