Created
June 10, 2015 21:27
-
-
Save Trucido/ca62329f1fa69e378e37 to your computer and use it in GitHub Desktop.
move opera cache to /tmp/cache for tmpfs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Copyright (c) 2015 Tara Nupsumass | |
# This script 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 2 of the License, or | |
# (at your option) any later version. | |
# | |
# This script 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. | |
# <http://www.gnu.org/licenses/> | |
# | |
# This script moves opera browser cache directorie(s) to /tmp/cache/, it should be run on user login. | |
# define our directories | |
OP_CACHE="$HOME/.cache/opera" | |
OP_TMP_CACHE="/tmp/cache/opera" | |
OPERA="`which "opera"`" | |
function OP | |
{ | |
# check if exists and is executable | |
if [[ -x $OPERA ]]; then | |
echo "$OPERA found." | |
# not found, abandoning this function. | |
else echo "OPERA not installed, skipping."; return | |
fi | |
# check if tmp cache exists, otherwise create it. | |
if [ ! -e $OP_TMP_CACHE ]; then | |
echo "$OP_TMP_CACHE not found, creating it" | |
mkdir -p "$OP_TMP_CACHE" | |
# if tmp cache directory already exists, skip creating it | |
else | |
echo "$OP_TMP_CACHE found, not creating it." | |
fi | |
# remove any remaining cache and symlink it | |
if [ -d $OP_CACHE ]; then | |
echo "existing $OP_CACHE found, deleting it." | |
rm -Rf "$OP_CACHE" | |
echo "symlinking $OP_TMP_CACHE to $OP_CACHE" | |
ln -s "$OP_TMP_CACHE" "$OP_CACHE" | |
else | |
echo "existing $OP_CACHE not found, good to go! symlinking $OP_TMP_CACHE to $OP_CACHE" | |
ln -s "$OP_TMP_CACHE" "$OP_CACHE" | |
fi | |
} | |
# function(s) loaded, running them! | |
OP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
so i got the intended output and i think i see something new created in /dev/shm after starting opera so i think this is working. Thank you!