├── .gitignore ├── INSTALL ├── LICENSE ├── Makefile ├── README.md ├── common ├── debian │ └── postinst ├── profile-cleaner.in └── zsh-completion └── doc ├── manpage.txt └── pc.1 /.gitignore: -------------------------------------------------------------------------------- 1 | /common/profile-cleaner 2 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | DEPENDENCIES 2 | bash>4 3 | bc 4 | findutils 5 | parallel 6 | sqlite 7 | 8 | BUILDING 9 | Setup the via a make. 10 | 11 | $ make 12 | 13 | Running a `make install` as root will distribute the files to 14 | the filesystem. 15 | 16 | # make install 17 | 18 | USE A DISTRO PROVIDED PACKAGE 19 | ARCH LINUX 20 | Arch users may build the package directly with the provided 21 | PKGBUILD: https://aur.archlinux.org/packages/profile-cleaner 22 | 23 | FEDORA 24 | Fedora users may use the rpms provided by graysky at this url: 25 | http://repo-ck.com/bench.htm#Fedora_RPMs 26 | 27 | GENTOO 28 | Gentoo users may use the ebuild provided by the laurentb overlay: 29 | http://gpo.zugaina.org/Overlays/laurentb/app-admin/profile-cleaner 30 | 31 | VOID LINUX 32 | Void users can download the package directly from the official repos. 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2023 graysky 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | VERSION = 2.45 2 | PN = profile-cleaner 3 | 4 | PREFIX ?= /usr 5 | BINDIR = $(PREFIX)/bin 6 | MANDIR = $(PREFIX)/share/man/man1 7 | ZSHDIR = $(PREFIX)/share/zsh/site-functions 8 | 9 | RM = rm 10 | SED = sed 11 | 12 | all: 13 | @echo -e '\033[1;32mSetting version\033[0m' 14 | @sed 's/@VERSION@/'$(VERSION)'/' common/$(PN).in > common/$(PN) 15 | 16 | install-bin: 17 | @echo -e '\033[1;32mInstalling main script, initd and config...\033[0m' 18 | install -Dm755 common/$(PN) "$(DESTDIR)$(BINDIR)/$(PN)" 19 | ln -s $(PN) "$(DESTDIR)$(BINDIR)/pc" 20 | install -d "$(DESTDIR)$(ZSHDIR)" 21 | install -m644 common/zsh-completion "$(DESTDIR)/$(ZSHDIR)/_pc" 22 | 23 | install-man: 24 | @echo -e '\033[1;32mInstalling manpage...\033[0m' 25 | install -Dm644 doc/pc.1 "$(DESTDIR)$(MANDIR)/pc.1" 26 | 27 | uninstall: 28 | $(RM) "$(DESTDIR)$(BINDIR)/$(PN)" 29 | $(RM) "$(DESTDIR)$(BINDIR)/pc" 30 | $(RM) "$(DESTDIR)/$(ZSHDIR)/_pc" 31 | 32 | install: install-bin install-man 33 | 34 | clean: 35 | $(RM) -f common/$(PN) 36 | 37 | .PHONY: install-bin install-man uninstall install clean 38 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Profile-cleaner 2 | Use profile-cleaner to reduce the size of browser profiles by organizing their sqlite databases using sqlite3's vacuum and reindex functions. The term "browser" is used loosely since profile-cleaner happily works on some email clients and newsreaders too. 3 | 4 | ## Supported Browsers 5 | * Brave (stable, beta, dev and nightly) (https://aur.archlinux.org/packages/brave-bin) 6 | * Chromium (stable, beta, and dev) 7 | * Conkeror 8 | * Edge 9 | * Falkon 10 | * Firefox (stable, beta, and aurora) 11 | * Google-chrome (stable, beta, and dev) 12 | * Heftig's version of Aurora (https://bbs.archlinux.org/viewtopic.php?id=117157) 13 | * Icecat 14 | * Icedove 15 | * Inox (https://bbs.archlinux.org/viewtopic.php?id=198763) 16 | * Librewolf 17 | * Midori 18 | * Newsboat 19 | * Palemoon 20 | * Qupzilla 21 | * Seamonkey 22 | * Thunderbird 23 | * Tor-browser 24 | * Vivaldi (stable and snapshot) 25 | 26 | ## Documentation 27 | Consult the man page. 28 | 29 | ## Installation from Source 30 | To build from source, see the included INSTALL text document. 31 | 32 | ## Installation from Distro Packages 33 | * ![logo](http://www.monitorix.org/imgs/archlinux.png "arch logo")Arch: in official [repo](https://archlinux.org/packages/extra/any/profile-cleaner/) 34 | * ![logo](https://linux-cdn.softpedia.com/screenshots/ico/Fedora-Games-Spin.gif "fedora logo")Fedora: in official [repo](https://src.fedoraproject.org/rpms/profile-cleaner) 35 | * ![logo](http://i.imgur.com/ooVjgFG.png "gentoo logo")Gentoo: See instructions below 36 | * ![logo](https://i.postimg.cc/13Jzxh5C/nix.png "nixos logo")NixOS: in the official [repo](https://search.nixos.org/packages?query=profile-cleaner) 37 | * ![logo](http://wiki.codeblocks.org/images/8/8b/Slackware-logo_32.png "slack logo")Slackware: on [slackbuilds](http://slackbuilds.org/apps/profile-cleaner/) 38 | 39 | ### Gentoo Users 40 | Profile cleaner is in the main repo: 41 | 42 | emerge -av app-admin/profile-cleaner 43 | 44 | ### Other Distros 45 | If you are interested in packaging profile-cleaner for your favorite distro, please contact me. 46 | 47 | ## Dependencies 48 | * bash 49 | * bc 50 | * findutils 51 | * sqlite 52 | * parallel 53 | 54 | ## Sample Output and Results Using an "Uncleaned" Firefox Profile: 55 | 56 | Size before: 154.17 Mbytes 57 | Size after: 99.11 Mbytes 58 | 59 | $ profile-cleaner f 60 | 61 | /home/facade/.mozilla/firefox/zee52krz.default/cookies.sqlite reduced by .87 Mbytes 62 | /home/facade/.mozilla/firefox/zee52krz.default/signons.sqlite reduced by .41 Mbytes 63 | /home/facade/.mozilla/firefox/zee52krz.default/downloads.sqlite reduced by .56 Mbytes 64 | /home/facade/.mozilla/firefox/zee52krz.default/chromeappsstore.sqlite reduced by .03 Mbytes 65 | /home/facade/.mozilla/firefox/zee52krz.default/urlclassifier3.sqlite reduced by 43.10 Mbytes 66 | /home/facade/.mozilla/firefox/zee52krz.default/formhistory.sqlite reduced by .11 Mbytes 67 | /home/facade/.mozilla/firefox/zee52krz.default/addons.sqlite reduced by 0 Mbytes 68 | /home/facade/.mozilla/firefox/zee52krz.default/permissions.sqlite reduced by 0 Mbytes 69 | /home/facade/.mozilla/firefox/zee52krz.default/content-prefs.sqlite reduced by 0 Mbytes 70 | /home/facade/.mozilla/firefox/zee52krz.default/extensions.sqlite reduced by 0 Mbytes 71 | /home/facade/.mozilla/firefox/zee52krz.default/webappsstore.sqlite reduced by 0 Mbytes 72 | /home/facade/.mozilla/firefox/zee52krz.default/OfflineCache/index.sqlite reduced by 0 Mbytes 73 | /home/facade/.mozilla/firefox/zee52krz.default/search.sqlite reduced by 0 Mbytes 74 | /home/facade/.mozilla/firefox/zee52krz.default/places.sqlite reduced by 9.98 Mbytes 75 | 76 | firefox profile reduced by 55.06 Mbytes 77 | 78 | ## Speed Comparison 79 | 28-Nov-2012 Profile-cleaner has been rewritten to use GNU Parallel for processing. 80 | 81 | Here is a contrived example cleaning 6 firefox profiles comparing the classical version of Profile-cleaner which used for loops to process profiles to the new version: 82 | 83 | * There are a total of 312 M in the 6 "dirty" profiles. 84 | * Test machine is an Intel 3770K @ 4.50 GHz. 85 | * After cleaning there is a total of 213 M in the 6 "clean" profiles. 86 | 87 | new 4.07s user 0.42s system 318% cpu 1.411 total 88 | 89 | old 8.15s user 0.43s system 95% cpu 8.942 total 90 | 91 | Your mileage may vary. 92 | -------------------------------------------------------------------------------- /common/debian/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | echo '--------------------------------------------------------------------------' 4 | echo ' Make sure that target browsers or email clients are not running when' 5 | echo ' invoking profile-cleaner. Failure to do so will result in the open files' 6 | echo ' NOT getting cleaned and reindexed.' 7 | echo 8 | echo ' $HOME/.config/profile-cleaner.conf will be created when the script is' 9 | echo ' called to run the first time. Edit it to select a color scheme.' 10 | echo '--------------------------------------------------------------------------' 11 | -------------------------------------------------------------------------------- /common/profile-cleaner.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # shellcheck disable=1090,2034 4 | # 5 | # $XDG_CONFIG_HOME should be mapped to $HOME/.config 6 | # $XDG_DATA_HOME should be mapped to $HOME/.local/share 7 | # some users may have modified it to a custom location so honor that 8 | 9 | XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" 10 | XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" 11 | VERS="@VERSION@" 12 | 13 | # 14 | # read in config file 15 | # 16 | 17 | config="$XDG_CONFIG_HOME/profile-cleaner.conf" 18 | 19 | if [[ -f "$config" ]]; then 20 | . "$config" 21 | else 22 | cat <> "$config" 23 | # 24 | # $HOME/.config/profile-cleaner.conf 25 | # 26 | 27 | # Define the background of your terminal theme here. 28 | # A setting of dark will produce colors that nicely contrast a dark background. 29 | # setting of light will produce colors that nicely contrast a light background. 30 | COLORS=dark 31 | #COLORS=light 32 | END 33 | fi 34 | 35 | [[ -z "$COLORS" ]] && COLORS="dark" 36 | 37 | if [[ "$COLORS" = "dark" ]]; then 38 | export BLD="\e[01m" RED="\e[01;31m" GRN="\e[01;32m" YLW="\e[01;33m" NRM="\e[00m" 39 | elif [[ "$COLORS" = "light" ]]; then 40 | export BLD="\e[01m" RED="\e[00;31m" GRN="\e[00;32m" YLW="\e[00;34m" NRM="\e[00m" 41 | fi 42 | 43 | echo -e "${BLD}profile-cleaner v$VERS${NRM}" 44 | echo 45 | 46 | dep_check() { 47 | for dep in bc find parallel sqlite3 xargs; do 48 | if ! command -v "$dep" > /dev/null 2>&1; then 49 | echo "I require $dep but it's not installed. Aborting." >&2 50 | exit 1 51 | fi 52 | done 53 | } 54 | 55 | do_clean() { 56 | echo -en "${GRN} Cleaning${NRM} ${1##*/}" 57 | bsize=$(du -b "$1" | cut -f 1) 58 | 59 | sqlite3 "$1" vacuum 60 | sqlite3 "$1" reindex 61 | 62 | asize=$(du -b "$1" | cut -f 1) 63 | dsize=$(echo "scale=2; ($bsize-$asize)/1048576" | bc) 64 | echo -e "$(tput cr)$(tput cuf 46) ${GRN}done${NRM} -${YLW}${dsize}${NRM} Mbytes" 65 | } 66 | 67 | do_clean_parallel () { 68 | [[ ${#toclean[@]} -eq 0 ]] && cleanedsize=0 && return 1 69 | bsize=$(du -b -c "${toclean[@]}" | tail -n 1 | cut -f 1) 70 | 71 | SHELL=/bin/bash parallel --gnu -k do_clean ::: "${toclean[@]}" 2>/dev/null 72 | 73 | asize=$(du -b -c "${toclean[@]}" | tail -n 1 | cut -f 1) 74 | cleanedsize=$(echo "scale=2; ($bsize-$asize)/1048576" | bc) 75 | } 76 | 77 | find_dbs() { 78 | toclean=() 79 | while read -r i; do 80 | toclean+=("${i}") 81 | done < <( find -L "$@" -maxdepth 2 -type f -not -name '*.sqlite-wal' -print0 2>/dev/null | xargs -0 file -e ascii | sed -n -e "s/:.*SQLite.*//p" ) 82 | } 83 | 84 | do_error_for_chromebased() { 85 | if [[ ! -d "$profilepath" ]]; then 86 | echo -e "${RED}Error: no profile directory found for:${NRM}${BLD}" "${missingArr[@]}" "${NRM}" 87 | exit 1 88 | fi 89 | } 90 | 91 | do_chromebased() { 92 | if [[ -h "$prepath" ]]; then 93 | profilepath=$(readlink "$prepath") 94 | else 95 | profilepath="$prepath" 96 | fi 97 | echo -e " ${YLW}Cleaning profile for $name${NRM}" 98 | find_dbs "$profilepath" 99 | do_clean_parallel 100 | echo 101 | echo -e " ${BLD}Profile(s) for $name reduced by ${YLW}${cleanedsize}${NRM} ${BLD}Mbytes.${NRM}" 102 | echo 103 | } 104 | 105 | do_xulbased() { 106 | if [[ -h "$prepath" ]]; then 107 | profilepath=$(readlink "$prepath") 108 | else 109 | profilepath="$prepath" 110 | fi 111 | 112 | if [[ ! -d "$profilepath" ]]; then 113 | echo -e "${RED}Error: cannot locate $profilepath${NRM}" 114 | echo -e "${BLD}This is the default path for $name and where $0 expects to find it.${NRM}" 115 | exit 1 116 | fi 117 | 118 | [[ ! -f $profilepath/profiles.ini ]] && 119 | echo -e "${RED}Error: cannot locate $profilepath/profiles.ini to determine names of profiles for $name.${NRM}" && 120 | exit 1 121 | 122 | # build an array correcting for rel and abs paths therein 123 | # while read -r will read line-by-line and will tolerate spaces 124 | # whereas a for loop will not 125 | 126 | index=0 127 | while read -r line; do 128 | if [[ ! -d "$profilepath/$line" ]]; then 129 | finalArr[index]="$line" 130 | else 131 | finalArr[index]="$profilepath/$line" 132 | fi 133 | index=$index+1 134 | done < <(grep '[Pp]'ath= "$profilepath/profiles.ini" | sed -e 's/[Pp]ath=//' -e 's/\r//' ) 135 | 136 | echo -e " ${YLW}Cleaning profile for $name${NRM}" 137 | find_dbs "${finalArr[@]}" 138 | do_clean_parallel 139 | echo 140 | echo -e " ${BLD}Profile(s) for $name reduced by ${YLW}${cleanedsize}${NRM} ${BLD}Mbytes.${NRM}" 141 | } 142 | 143 | do_dbbased() { 144 | if [[ -h "$prepath" ]]; then 145 | profilepath=$(readlink "$prepath") 146 | else 147 | profilepath="$prepath" 148 | fi 149 | if [[ ! -d "$profilepath" ]]; then 150 | echo -e "${RED}Error: no profile directory for $name found.${NRM}" && 151 | exit 1 152 | fi 153 | echo -e " ${YLW}Cleaning profile for $name${NRM}" 154 | find_dbs "${profilepath}" 155 | do_clean_parallel 156 | echo 157 | echo -e " ${BLD}Profile(s) for $name reduced by ${YLW}${cleanedsize}${NRM} ${BLD}Mbytes.${NRM}" 158 | } 159 | 160 | do_paths() { 161 | profilepaths=() 162 | for profilepath in "$@"; do 163 | [[ -d "$profilepath" ]] && profilepaths+=("$profilepath") 164 | done 165 | find_dbs "${profilepaths[@]}" 166 | do_clean_parallel 167 | echo 168 | echo -e " ${BLD}Profile(s) for $name reduced by ${YLW}${cleanedsize}${NRM} ${BLD}Mbytes.${NRM}" 169 | } 170 | 171 | export -f do_clean 172 | dep_check 173 | GREP_OPTIONS= 174 | 175 | case "$1" in 176 | B|b) 177 | for name in Brave-Browser Brave-Browser-Dev Brave-Browser-Beta Brave-Browser-Nightly; do 178 | if [[ -d "$XDG_CONFIG_HOME"/BraveSoftware/$name ]]; then 179 | tocleanArr+=("$name") 180 | else 181 | missingArr+=("$name") 182 | fi 183 | done 184 | if [[ "${#tocleanArr[@]}" -eq 0 ]]; then 185 | do_error_for_chromebased 186 | else 187 | for name in "${tocleanArr[@]}"; do 188 | export name 189 | prepath="$XDG_CONFIG_HOME"/BraveSoftware/$name 190 | do_chromebased 191 | done 192 | fi 193 | exit 0 194 | ;; 195 | C|c|CB|cb|CD|cd) 196 | for name in chromium chromium-beta chromium-dev; do 197 | if [[ -d "$XDG_CONFIG_HOME"/$name ]]; then 198 | tocleanArr+=("$name") 199 | else 200 | missingArr+=("$name") 201 | fi 202 | done 203 | if [[ "${#tocleanArr[@]}" -eq 0 ]]; then 204 | do_error_for_chromebased 205 | else 206 | for name in "${tocleanArr[@]}"; do 207 | export name 208 | prepath="$XDG_CONFIG_HOME"/$name 209 | do_chromebased 210 | done 211 | fi 212 | exit 0 213 | ;; 214 | E|e) 215 | name=microsoft-edge 216 | if [[ -d "$XDG_CONFIG_HOME"/$name ]]; then 217 | tocleanArr+=("$name") 218 | else 219 | missingArr+=("$name") 220 | fi 221 | if [[ "${#tocleanArr[@]}" -eq 0 ]]; then 222 | do_error_for_chromebased 223 | else 224 | for name in "${tocleanArr[@]}"; do 225 | export name 226 | prepath="$XDG_CONFIG_HOME"/$name 227 | do_chromebased 228 | done 229 | fi 230 | exit 0 231 | ;; 232 | GC|gc|GCB|gcb|GCD|gcd|GCU|gcu) 233 | for name in google-chrome google-chrome-beta google-chrome-unstable; do 234 | if [[ -d "$XDG_CONFIG_HOME"/$name ]]; then 235 | tocleanArr+=("$name") 236 | else 237 | missingArr+=("$name") 238 | fi 239 | done 240 | if [[ "${#tocleanArr[@]}" -eq 0 ]]; then 241 | do_error_for_chromebased 242 | else 243 | for name in "${tocleanArr[@]}"; do 244 | export name 245 | prepath="$XDG_CONFIG_HOME"/$name 246 | do_chromebased 247 | done 248 | fi 249 | exit 0 250 | ;; 251 | ix|IX) 252 | name="inox"; export name 253 | prepath="$XDG_CONFIG_HOME"/$name 254 | if [[ -d "$XDG_CONFIG_HOME"/$name ]]; then 255 | do_chromebased 256 | else 257 | do_error_for_chromebased 258 | fi 259 | exit 0 260 | ;; 261 | n|N) 262 | name="newsboat"; export name 263 | if [[ -d "$XDG_DATA_HOME"/$name ]]; then 264 | prepath="$XDG_DATA_HOME"/$name 265 | elif [[ -d "$HOME/.$name" ]]; then 266 | prepath="$HOME/.$name" 267 | fi 268 | do_dbbased 269 | exit 0 270 | ;; 271 | o|O|on|ON|od|OD|ob|OB) 272 | for name in opera opera-next opera-developer opera-beta; do 273 | if [[ -d "$XDG_CONFIG_HOME"/$name ]]; then 274 | tocleanArr+=("$name") 275 | else 276 | missingArr+=("$name") 277 | fi 278 | done 279 | if [[ "${#tocleanArr[@]}" -eq 0 ]]; then 280 | do_error_for_chromebased 281 | else 282 | for name in "${tocleanArr[@]}"; do 283 | export name 284 | prepath="$XDG_CONFIG_HOME"/$name 285 | do_chromebased 286 | done 287 | fi 288 | exit 0 289 | ;; 290 | V|v) 291 | for name in vivaldi vivaldi-snapshot; do 292 | if [[ -d "$XDG_CONFIG_HOME"/$name ]]; then 293 | tocleanArr+=("$name") 294 | else 295 | missingArr+=("$name") 296 | fi 297 | done 298 | if [[ "${#tocleanArr[@]}" -eq 0 ]]; then 299 | do_error_for_chromebased 300 | else 301 | for name in "${tocleanArr[@]}"; do 302 | export name 303 | prepath="$XDG_CONFIG_HOME"/$name 304 | do_chromebased 305 | done 306 | fi 307 | exit 0 308 | ;; 309 | H|h) 310 | name="aurora"; export name 311 | prepath=$HOME/.mozilla/aurora 312 | do_xulbased 313 | exit 0 314 | ;; 315 | CK|ck) 316 | name="conkeror"; export name 317 | prepath=$HOME/.conkeror.mozdev.org/$name 318 | do_xulbased 319 | exit 0 320 | ;; 321 | F|f) 322 | name="firefox"; export name 323 | prepath=$HOME/.mozilla/$name 324 | do_xulbased 325 | exit 0 326 | ;; 327 | FA|fa|Fa) 328 | name="falkon"; export name 329 | prepath=$HOME/.config/$name/profiles 330 | do_dbbased 331 | exit 0 332 | ;; 333 | I|i) 334 | name="icecat"; export name 335 | prepath=$HOME/.mozilla/$name 336 | do_xulbased 337 | exit 0 338 | ;; 339 | ID|id) 340 | name="icedove"; export name 341 | prepath=$HOME/.$name 342 | do_xulbased 343 | exit 0 344 | ;; 345 | L|l) 346 | name="librewolf"; export name 347 | prepath=$HOME/.$name 348 | do_xulbased 349 | exit 0 350 | ;; 351 | M|m) 352 | name="midori"; export name 353 | prepath="$XDG_CONFIG_HOME"/$name 354 | do_dbbased 355 | exit 0 356 | ;; 357 | PM|pm) 358 | name="palemoon"; export name 359 | prepath=$HOME/.moonchild\ productions/pale\ moon 360 | do_xulbased 361 | exit 0 362 | ;; 363 | P|p) 364 | name="paths"; export name 365 | shift 366 | do_paths "$@" 367 | exit 0 368 | ;; 369 | S|s) 370 | name="seamonkey"; export name 371 | prepath=$HOME/.mozilla/$name 372 | do_xulbased 373 | exit 0 374 | ;; 375 | Q|q) 376 | name="qupzilla"; export name 377 | prepath=$HOME/.config/$name/profiles 378 | do_dbbased 379 | exit 0 380 | ;; 381 | T|t) 382 | name="thunderbird"; export name 383 | prepath=$HOME/.$name 384 | do_xulbased 385 | exit 0 386 | ;; 387 | TO|to) 388 | name="torbrowser"; export name 389 | prepath=$HOME/.$name/profile 390 | 391 | # AUR packages for tor-browser customize this for some reason so check for 392 | # all in a silly for loop this is a shitty solution if users have more than 393 | # 1 language of tor-browser installed 394 | 395 | for lang in de en es fr it ru; do 396 | [[ ! -d "$prepath" ]] && 397 | prepath="$HOME/.tor-browser-$lang/INSTALL/Data/profile" 398 | done 399 | do_dbbased 400 | exit 0 401 | ;; 402 | *) 403 | echo -e " ${BLD}$0 ${NRM}${GRN}{browser abbreviation}${NRM}" 404 | echo 405 | echo -e " ${BLD}b) ${GRN}b${NRM}${BLD}rave (stable, beta, dev and nightly)${NRM}" 406 | echo -e " ${BLD}c) ${GRN}c${NRM}${BLD}hromium (stable, beta, and dev)${NRM}" 407 | echo -e " ${BLD}e) ${GRN}e${NRM}${BLD}dge${NRM}" 408 | echo -e " ${BLD}f) ${GRN}f${NRM}${BLD}irefox (stable and beta)${NRM}" 409 | echo -e " ${BLD}fa) ${GRN}fa${NRM}${BLD}lkon${NRM}" 410 | echo -e " ${BLD}gc) ${GRN}g${NRM}${BLD}oogle-${GRN}c${NRM}${BLD}hrome (stable, beta, and dev)${NRM}" 411 | echo -e " ${BLD}o) ${GRN}o${NRM}${BLD}pera (stable, next, and developer)${NRM}" 412 | echo 413 | echo -e " ${BLD}ck) ${GRN}c${NRM}${BLD}on${GRN}k${NRM}${BLD}eror${NRM}" 414 | echo -e " ${BLD}h) ${GRN}h${NRM}${BLD}eftig's aurora${NRM}" 415 | echo -e " ${BLD}i) ${GRN}i${NRM}${BLD}cecat${NRM}" 416 | echo -e " ${BLD}id) ${GRN}i${NRM}${BLD}ce${GRN}d${NRM}${BLD}ove${NRM}" 417 | echo -e " ${BLD}ix) ${GRN}i${NRM}${BLD}no${GRN}x${NRM}" 418 | echo -e " ${BLD}l) ${GRN}l${NRM}${BLD}ibrewolf${NRM}" 419 | echo -e " ${BLD}m) ${GRN}m${NRM}${BLD}idori${NRM}" 420 | echo -e " ${BLD}n) ${GRN}n${NRM}${BLD}ewsboat${NRM}" 421 | echo -e " ${BLD}pm) ${GRN}p${NRM}${BLD}ale${GRN}m${NRM}${BLD}oon${NRM}" 422 | echo -e " ${BLD}q) ${GRN}q${NRM}${BLD}upZilla${NRM}" 423 | echo -e " ${BLD}s) ${GRN}s${NRM}${BLD}eamonkey${NRM}" 424 | echo -e " ${BLD}t) ${GRN}t${NRM}${BLD}hunderbird${NRM}" 425 | echo -e " ${BLD}to) ${GRN}to${NRM}${BLD}rbrowser${NRM}" 426 | echo -e " ${BLD}v) ${GRN}v${NRM}${BLD}ivaldi (stable and snapshot)${NRM}" 427 | echo 428 | echo -e " ${BLD}p) ${GRN}p${NRM}${BLD}aths${NRM}" 429 | exit 0 430 | ;; 431 | esac 432 | 433 | # vim:set ts=2 sw=2 et: 434 | -------------------------------------------------------------------------------- /common/zsh-completion: -------------------------------------------------------------------------------- 1 | #compdef pc profile-cleaner 2 | 3 | _pc() { 4 | local -a options 5 | 6 | options=( 7 | 'b:Brave (stable, beta, dev and nightly)' 8 | 'c:Chromium (stable, beta, and dev)' 9 | 'ck:ConKeror' 10 | 'f:Firefox (stable and beta)' 11 | 'fa:Falkon' 12 | 'gc:Google-Chrome (stable, beta, and dev)' 13 | 'h:Heftigs aurora' 14 | 'i:Icecat' 15 | 'id:IceDove' 16 | 'ix:InoX' 17 | 'm:Midori' 18 | 'n:Newsboat' 19 | 'o:Opera (stable, next, and developer)' 20 | 'pm:PaleMoon' 21 | 'q:QupZilla' 22 | 's:Seamonkey' 23 | 't:Thunderbird' 24 | 'to:TOrbrowser' 25 | 'p:Paths' 26 | 'v:Vivaldi (stable and snapshot)' 27 | ) 28 | 29 | _describe 'options' options 30 | } 31 | 32 | _pc 33 | -------------------------------------------------------------------------------- /doc/manpage.txt: -------------------------------------------------------------------------------- 1 | NAME 2 | profile-cleaner - Reduce the size of browser and some email program's profiles by organizing their sqlite databases using sqlite3's vacuum and reindex functions. The term "browser" is used loosely since profile-cleaner happily works on some email clients too. 3 | 4 | SYNOPSIS 5 | profile-cleaner [option] 6 | 7 | DESCRIPTION 8 | Profile-cleaner is a very simple shell script that will invoke sqlite3 to vacuum and reindex databases belonging to supported browsers and email clients. It is compatible with profile-sync-daemon so users need not stop psd before calling profile-cleaner. In fact, profiles will clean much faster when they are synced to tmpfs via psd. 9 | 10 | OPTIONS 11 | b Clean brave's profile 12 | 13 | c Clean chromium's profile 14 | 15 | ck Clean conkeror's profile(s)* 16 | 17 | e Clean edge's profile 18 | 19 | f Clean firefox's profile(s)* 20 | 21 | fa Clean falkon's profile 22 | 23 | gc Clean google-chrome's profile 24 | 25 | h Clean heftig aurora's profile(s)* 26 | 27 | i Clean icecat's profile(s)* 28 | 29 | id Clean icedove's profile 30 | 31 | ix Clean Inox's profile 32 | 33 | l Clean Librewolf's profile 34 | 35 | m Clean midori's profile 36 | 37 | o Clean opera's profile 38 | 39 | t Clean thunderbird's profile(s)* 40 | 41 | to Clean tor-browser's profile 42 | 43 | s Clean seamonkey's profile(s)* 44 | 45 | pm Clean palemoon's profile(s)* 46 | 47 | p Clean the defined paths 48 | 49 | v Clean vivaldi's profile 50 | 51 | 52 | *Profile-cleaner will parse the respective profiles.ini file and clean all profiles defined therein. 53 | 54 | CONFIG FILE 55 | Profile-cleaner will create $HOME/.config/profile-cleaner.conf the first time it is invoked. Users may define a color scheme therein based on their terminal background color. The default is a dark scheme for dark colored terminals. The file is commented and self-explanatory. 56 | 57 | EXAMPLES 58 | Clean all firefox profiles: 59 | 60 | 61 | $ profile-cleaner f 62 | 63 | Clean chromium profile: 64 | 65 | 66 | $ profile-cleaner c 67 | 68 | Clean the user defined profile: 69 | 70 | 71 | $ profile-cleaner p /path/to/profile 72 | 73 | SUPPORTED BROWSERS AND EMAIL CLIENTS 74 | Currently, the following are supported: 75 | o Brave (stable, beta, dev and nightly) 76 | o Chromium (stable,beta,dev) 77 | o Conkeror 78 | o Edge 79 | o Firefox (stable,beta,aurora) 80 | o Google-chrome (stable,beta,dev) 81 | o Heftig's version of Aurora (https://bbs.archlinux.org/viewtopic.php?id=117157) 82 | o Inox (https://bbs.archlinux.org/viewtopic.php?id=198763) 83 | o Midori 84 | o Newsbeuter 85 | o Opera (stable, next, and developer) 86 | o Seamonkey 87 | o Thunderbird 88 | o Tor-browser 89 | o Vivaldi (stable and snapshot) 90 | 91 | SAMPLE OUTPUT 92 | Sample output invoking the firefox option (your mileage will vary). 93 | 94 | 95 | $ profile-cleaner f 96 | /home/facade/.mozilla/firefox/zee52krz.default/cookies.sqlite reduced by .87 Mbytes 97 | /home/facade/.mozilla/firefox/zee52krz.default/signons.sqlite reduced by .41 Mbytes 98 | /home/facade/.mozilla/firefox/zee52krz.default/downloads.sqlite reduced by .56 Mbytes 99 | /home/facade/.mozilla/firefox/zee52krz.default/chromeappsstore.sqlite reduced by .03 Mbytes 100 | /home/facade/.mozilla/firefox/zee52krz.default/urlclassifier3.sqlite reduced by 43.10 Mbytes 101 | /home/facade/.mozilla/firefox/zee52krz.default/formhistory.sqlite reduced by .11 Mbytes 102 | /home/facade/.mozilla/firefox/zee52krz.default/addons.sqlite reduced by 0 Mbytes 103 | /home/facade/.mozilla/firefox/zee52krz.default/permissions.sqlite reduced by 0 Mbytes 104 | /home/facade/.mozilla/firefox/zee52krz.default/content-prefs.sqlite reduced by 0 Mbytes 105 | /home/facade/.mozilla/firefox/zee52krz.default/extensions.sqlite reduced by 0 Mbytes 106 | /home/facade/.mozilla/firefox/zee52krz.default/webappsstore.sqlite reduced by 0 Mbytes 107 | /home/facade/.mozilla/firefox/zee52krz.default/OfflineCache/index.sqlite reduced by 0 Mbytes 108 | /home/facade/.mozilla/firefox/zee52krz.default/search.sqlite reduced by 0 Mbytes 109 | /home/facade/.mozilla/firefox/zee52krz.default/places.sqlite reduced by 9.98 Mbytes 110 | 111 | firefox profile reduced by 55.06 Mbytes 112 | 113 | CONTRIBUTE 114 | Should you wish to contribute to this code, please fork and send a pull request. Source is freely available on github: https://github.com/graysky2/profile-cleaner 115 | 116 | BUGS 117 | None known. 118 | 119 | AUTHOR 120 | graysky (therealgraysky AT proton DOT me) 121 | 122 | SEE ALSO 123 | profile-sync-deamon (1) 124 | -------------------------------------------------------------------------------- /doc/pc.1: -------------------------------------------------------------------------------- 1 | .\" Text automatically generated by txt2man 2 | .TH profile-cleaner 1 "29 May 2023" "" "" 3 | .SH NAME 4 | \fBprofile-cleaner \fP- Reduce the size of browser and some email program's profiles by organizing their sqlite databases using sqlite3's vacuum and reindex functions. The term "browser" is used loosely since profile-cleaner happily works on some email clients too. 5 | \fB 6 | .SH SYNOPSIS 7 | .nf 8 | .fam C 9 | \fBprofile-cleaner\fP [\fIoption\fP] 10 | 11 | .fam T 12 | .fi 13 | .fam T 14 | .fi 15 | .SH DESCRIPTION 16 | Profile-cleaner is a very simple shell script that will invoke sqlite3 to vacuum and reindex databases belonging to supported browsers and email clients. It is compatible with profile-sync-daemon so users need not stop psd before calling \fBprofile-cleaner\fP. In fact, profiles will clean much faster when they are synced to tmpfs via psd. 17 | .SH OPTIONS 18 | .TP 19 | .B 20 | b 21 | Clean brave's profile 22 | .TP 23 | .B 24 | c 25 | Clean chromium's profile 26 | .TP 27 | .B 28 | ck 29 | Clean conkeror's \fBprofile\fP(s)* 30 | .TP 31 | .B 32 | e 33 | Clean edge's profile 34 | .TP 35 | .B 36 | f 37 | Clean firefox's \fBprofile\fP(s)* 38 | .TP 39 | .B 40 | fa 41 | Clean falkon's profile 42 | .TP 43 | .B 44 | gc 45 | Clean google-chrome's profile 46 | .TP 47 | .B 48 | h 49 | Clean heftig aurora's \fBprofile\fP(s)* 50 | .TP 51 | .B 52 | i 53 | Clean icecat's \fBprofile\fP(s)* 54 | .TP 55 | .B 56 | id 57 | Clean icedove's profile 58 | .TP 59 | .B 60 | ix 61 | Clean Inox's profile 62 | .TP 63 | .B 64 | l 65 | Clean Librewolf's profile 66 | .TP 67 | .B 68 | m 69 | Clean midori's profile 70 | .TP 71 | .B 72 | o 73 | Clean opera's profile 74 | .TP 75 | .B 76 | t 77 | Clean thunderbird's \fBprofile\fP(s)* 78 | .TP 79 | .B 80 | to 81 | Clean tor-browser's profile 82 | .TP 83 | .B 84 | s 85 | Clean seamonkey's \fBprofile\fP(s)* 86 | .TP 87 | .B 88 | pm 89 | Clean palemoon's \fBprofile\fP(s)* 90 | .TP 91 | .B 92 | p 93 | Clean the defined paths 94 | .TP 95 | .B 96 | v 97 | Clean vivaldi's profile 98 | .RE 99 | .PP 100 | 101 | .RS 102 | *Profile-cleaner will parse the respective profiles.ini file and clean all profiles defined therein. 103 | .SH CONFIG FILE 104 | Profile-cleaner will create $HOME/.config/profile-cleaner.conf the first time it is invoked. Users may define a color scheme therein based on their terminal background color. The default is a dark scheme for dark colored terminals. The file is commented and self-explanatory. 105 | .SH EXAMPLES 106 | Clean all firefox profiles: 107 | .RE 108 | .PP 109 | 110 | .nf 111 | .fam C 112 | $ profile-cleaner f 113 | 114 | .fam T 115 | .fi 116 | .RS 117 | Clean chromium profile: 118 | .RE 119 | .PP 120 | 121 | .nf 122 | .fam C 123 | $ profile-cleaner c 124 | 125 | .fam T 126 | .fi 127 | .RS 128 | Clean the user defined profile: 129 | .RE 130 | .PP 131 | 132 | .nf 133 | .fam C 134 | $ profile-cleaner p /path/to/profile 135 | 136 | .fam T 137 | .fi 138 | .SH SUPPORTED BROWSERS AND EMAIL CLIENTS 139 | Currently, the following are supported: 140 | .IP \(bu 3 141 | Brave (stable, beta, dev and nightly) 142 | .IP \(bu 3 143 | Chromium (stable,beta,dev) 144 | .IP \(bu 3 145 | Conkeror 146 | .IP \(bu 3 147 | Edge 148 | .IP \(bu 3 149 | Firefox (stable,beta,aurora) 150 | .IP \(bu 3 151 | Google-chrome (stable,beta,dev) 152 | .IP \(bu 3 153 | Heftig's version of Aurora (https://bbs.archlinux.org/viewtopic.php?id=117157) 154 | .IP \(bu 3 155 | Inox (https://bbs.archlinux.org/viewtopic.php?id=198763) 156 | .IP \(bu 3 157 | Midori 158 | .IP \(bu 3 159 | Newsbeuter 160 | .IP \(bu 3 161 | Opera (stable, next, and developer) 162 | .IP \(bu 3 163 | Seamonkey 164 | .IP \(bu 3 165 | Thunderbird 166 | .IP \(bu 3 167 | Tor-browser 168 | .IP \(bu 3 169 | Vivaldi (stable and snapshot) 170 | .SH SAMPLE OUTPUT 171 | Sample output invoking the firefox \fIoption\fP (your mileage will vary). 172 | .RE 173 | .PP 174 | 175 | .nf 176 | .fam C 177 | $ profile-cleaner f 178 | /home/facade/.mozilla/firefox/zee52krz.default/cookies.sqlite reduced by .87 Mbytes 179 | /home/facade/.mozilla/firefox/zee52krz.default/signons.sqlite reduced by .41 Mbytes 180 | /home/facade/.mozilla/firefox/zee52krz.default/downloads.sqlite reduced by .56 Mbytes 181 | /home/facade/.mozilla/firefox/zee52krz.default/chromeappsstore.sqlite reduced by .03 Mbytes 182 | /home/facade/.mozilla/firefox/zee52krz.default/urlclassifier3.sqlite reduced by 43.10 Mbytes 183 | /home/facade/.mozilla/firefox/zee52krz.default/formhistory.sqlite reduced by .11 Mbytes 184 | /home/facade/.mozilla/firefox/zee52krz.default/addons.sqlite reduced by 0 Mbytes 185 | /home/facade/.mozilla/firefox/zee52krz.default/permissions.sqlite reduced by 0 Mbytes 186 | /home/facade/.mozilla/firefox/zee52krz.default/content-prefs.sqlite reduced by 0 Mbytes 187 | /home/facade/.mozilla/firefox/zee52krz.default/extensions.sqlite reduced by 0 Mbytes 188 | /home/facade/.mozilla/firefox/zee52krz.default/webappsstore.sqlite reduced by 0 Mbytes 189 | /home/facade/.mozilla/firefox/zee52krz.default/OfflineCache/index.sqlite reduced by 0 Mbytes 190 | /home/facade/.mozilla/firefox/zee52krz.default/search.sqlite reduced by 0 Mbytes 191 | /home/facade/.mozilla/firefox/zee52krz.default/places.sqlite reduced by 9.98 Mbytes 192 | 193 | firefox profile reduced by 55.06 Mbytes 194 | 195 | .fam T 196 | .fi 197 | .SH CONTRIBUTE 198 | Should you wish to contribute to this code, please fork and send a pull request. Source is freely available on github: https://github.com/graysky2/\fBprofile-cleaner\fP 199 | .SH BUGS 200 | None known. 201 | .SH AUTHOR 202 | graysky (therealgraysky AT proton DOT me) 203 | .SH SEE ALSO 204 | profile-sync-deamon (1) 205 | --------------------------------------------------------------------------------