Skip to content

Commit

Permalink
improve sudo experience
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuseteam committed Apr 15, 2024
1 parent 3e7a42e commit 701c33f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions crackle
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ APT_CACHE="apt-cache -o Dir::Cache=$APTCACHE -o Dir::State=$APTSTATE -o Dir::Etc
}
[[ -z "$rootprofile" ]] && {
say "Amending /root/.profile...";
_crackleconf -v start="#rootprofile" "$SCRP_DIR"/crackle.conf | sudo -k tee --append /root/.profile > /dev/null;
_crackleconf -v start="#rootprofile" "$SCRP_DIR"/crackle.conf | sudo_run "tee --append /root/.profile > /dev/null";
sudo -K;
}

[[ -d "$PKG_PREFIX/lib/crackle" ]] || mkdir -p "$PKG_PREFIX/lib/crackle";
Expand Down Expand Up @@ -276,6 +277,7 @@ APT_CACHE="apt-cache -o Dir::Cache=$APTCACHE -o Dir::State=$APTSTATE -o Dir::Etc
sudo_run "find $SUDO_BIN -xtype l -exec rm {} +";
sudo_run "find $SUDO_CONFIG -xtype l -exec rm {} +";
find "$CRACKLECMP" -xtype l -exec rm {} +;
sudo -K;
say "Done";
exit 0;
}
Expand All @@ -297,11 +299,12 @@ APT_CACHE="apt-cache -o Dir::Cache=$APTCACHE -o Dir::State=$APTSTATE -o Dir::Etc
[[ -f "$CRACKLECMP/crackle" ]] && rm $CRACKLECMP/crackle;
[[ -d "$PKG_PREFIX/lib/crackle" ]] && rm -r $PKG_PREFIX/lib/crackle;
find "$PKG_PREFIX/bin" -xtype l -exec rm {} +;
find "$SUDO_BIN" -xtype l -exec rm {} +;
find "$SUDO_CONFIG" -xtype l -exec rm {} +;
sudo_run "find $SUDO_BIN -xtype l -exec rm {} +";
sudo_run "find $SUDO_CONFIG -xtype l -exec rm {} +";
find "${XDG_DATA_HOME:-$HOME/.local/share}" -xtype l -exec rm {} + 2> /dev/null;
sed -i '/cracklerc/d' $HOME/.bashrc
sed -i '/cracklerc/d' $HOME/.profile
find "$CRACKLECMP" -xtype l -exec rm {} +;
sudo -K
exit 0;
}
1 change: 1 addition & 0 deletions lib/linkfunc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function link_bin(){
[ -d "$PKGS_DIR/usr/bin" ] && ln -s $PKGS_DIR/usr/bin/* $PKG_PREFIX/bin 2> /dev/null;
[ -d "$PKGS_DIR/usr/sbin" ] && sudo_run "ln -s $PKGS_DIR/usr/sbin/* $SUDO_BIN 2> /dev/null";
[ -d "$PKGS_DIR/usr/games" ] && ln -s $PKGS_DIR/usr/games/* $PKG_PREFIX/bin 2> /dev/null;
sudo -K;
}

function link_bash-completion(){
Expand Down
2 changes: 1 addition & 1 deletion lib/triplet
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ checkpath() {
sudo_run() {
say "this action requires sudo access"
set -x
sudo -k $1
sudo $1
set +x
}
download_crackle() {
Expand Down

0 comments on commit 701c33f

Please sign in to comment.