Skip to content

Commit

Permalink
introducing crackle sudo; make your commands available under `sudo -i…
Browse files Browse the repository at this point in the history
… command`
  • Loading branch information
Fuseteam committed Apr 19, 2024
1 parent b385dc5 commit d2bf600
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion crackle
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ if [ -z "$operation" -o "$operation" = "help" ]; then
echo 'available commands:
- crackle setup
- crackle debug
- crackle sudo $PKG
- crackle install $PKG
- crackle reinstall $PKG
- crackle download $PKG
Expand All @@ -101,7 +102,7 @@ if [ -z "$operation" -o "$operation" = "help" ]; then
fi

case $operation in
"install"|"reinstall"|"download"|"crack"|"remove"|"search"|"show"|"remove")[ -z "$PKG" ] && err "missing argument";;
"install"|"reinstall"|"download"|"crack"|"remove"|"search"|"show"|"remove"|"sudo")[ -z "$PKG" ] && err "missing argument";;
"setup"|"debug"|"clean"|"update"|"nuke"|"list");;
"click")[ -z "$PKG" ] && err "missing argument";build_click;;
*) err 'available operations (setup|debug|install $PKG|download $PKG|crack $PKG|remove $PKG|clean|search $PKG|show $PKG|update|remove $PKG)';;
Expand Down Expand Up @@ -260,6 +261,16 @@ APT_CACHE="apt-cache -o Dir::Cache=$APTCACHE -o Dir::State=$APTSTATE -o Dir::Etc
exit 0;
}

[[ "$operation" = "sudo" ]] && {
for pkg in "${PKG[@]}"
do
bin_path=$(which $pkg)
real_path=$(realpath $bin_path)
sudo_run "ln -s $real_path $SUDO_BIN/$pkg"
[[ -d $PKG_PATH/$pkg ]] && touch $PKG_PATH/$pkg/$pkg.sudo
done;
}

# reinstall a package
[[ "$operation" = "reinstall" ]] && {
crackle remove ${PKG[@]};
Expand Down

0 comments on commit d2bf600

Please sign in to comment.