Skip to content

Commit

Permalink
optimize crackle setup for upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuseteam committed May 14, 2022
1 parent e4ef614 commit 93a4a44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crackle
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ APT_CACHE="apt-cache -o Dir::Cache=$APTCACHE -o Dir::State=$APTSTATE -o Dir::Etc

# Installs/updates Crackle into ~/.local ~/.config and ~/.cache
[ "$operation" = "setup" ] && {
[[ $(basename $SCRP_DIR) = "bin" && -d $HOME/crackle ]] && rm -r $HOME/crackle;
[[ $(basename $SCRP_DIR) = "bin" || -f $HOME/Downloads/crackle.zip ]] && upgrade_crackle;
[[ $(basename $SCRP_DIR) = "bin" ]] && upgrade_crackle;
if check_cmd crackle; then transistion_crackle; fi
[[ -z "$(ls $SCRP_DIR/bin)" && $(basename $SCRP_DIR) != "bin" ]] && err "submodule missing";
bashrc=$(grep crackle "$HOME"/.bashrc);
profile=$(grep crackle "$HOME"/.profile);
Expand Down
7 changes: 4 additions & 3 deletions lib/triplet
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ download_crackle() {
}

unzip_crackle() {
[[ -d $HOME/crackle ]] && rm -r $HOME/crackle;
say "unpacking..."
unzip -q $HOME/Downloads/crackle.zip -d $HOME/crackle
}
Expand All @@ -74,12 +75,12 @@ upgrade_crackle() {
[[ ! -f $HOME/Downloads/crackle.zip ]] && download_crackle;
[[ ! -d $HOME/crackle ]] && unzip_crackle;
transistion_crackle
[[ $(basename $SCRP_DIR) = "bin" ]] || $HOME/crackle/crackle setup
$HOME/crackle/crackle setup
say "cleaning up..."
rm -r $HOME/crackle;
rm $HOME/Downloads/crackle.zip;
say "done!"
exit 0;

}

# remove lines, files and folders that crackle added/installed once upon a time
Expand All @@ -94,7 +95,7 @@ transistion_crackle() {
[[ -d "$PKG_PREFIX/bin/scripts" ]] && rm -r "$PKG_PREFIX/bin/scripts";
[[ -f "$APTCONFIG/crackle_completion" ]] && rm "$APTCONFIG/crackle_completion";
[[ -d "$PKG_PATH/bin/scripts" ]] && rm -r "$PKG_PATH/bin/scripts";
[ -f $HOME/.bash_completion ] && sed -i '/crackle_conmpletion/d' $HOME/.bash_completion
[ -f $HOME/.bash_completion ] && sed -i '/crackle_completion/d' $HOME/.bash_completion
}

# check is a command exists
Expand Down

0 comments on commit 93a4a44

Please sign in to comment.