Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated to use new apt rather than apt-get #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions functions/apt-queue.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function apt-queue
set i 0
tput sc
set locked (sudo fuser /var/lib/dpkg/lock ^ /dev/null)
while test -n "$locked"
set indicator (math $i%4)
switch $indicator
case 0
set j "-"
case 1
set j "\\"
case 2
set j "|"
case 3
set j "/"
end
tput rc
echo -en "\r[$j] Waiting for other software managers to finish..."
sleep 0.5
set i (math i+1)
set locked (sudo fuser /var/lib/dpkg/lock ^ /dev/null)
end
#echo -e "\n\nREADY!"
end
14 changes: 8 additions & 6 deletions functions/apt.fish
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,21 @@ function apt -d "Short and friendly command wrapper for APT"
set ppa_purge_flags $ppa_purge_flags "-y"
end

# Wait for package manager lock
apt-queue
# Parse and execute the given command.
switch $argv[1]
case autoremove
sudo apt-get $apt_get_flags autoremove
sudo apt $apt_get_flags autoremove

case check
sudo apt-get $apt_get_flags check

case clean
sudo apt-get $apt_get_flags autoclean
sudo apt $apt_get_flags autoclean

case install in
sudo apt-get $apt_get_flags install $argv[2..-1]
sudo apt $apt_get_flags install $argv[2..-1]

case policy
env LANG=C apt-cache policy
Expand Down Expand Up @@ -106,13 +108,13 @@ function apt -d "Short and friendly command wrapper for APT"
apt-cache show $argv[2..-1]

case update up
sudo apt-get $apt_get_flags update
sudo apt $apt_get_flags update

case upgrade
if set -q argv[2]; and test $argv[2] = dist
sudo apt-get $apt_get_flags dist-upgrade
sudo apt $apt_get_flags dist-upgrade
else
sudo apt-get $apt_get_flags upgrade
sudo apt $apt_get_flags upgrade
end

case moo
Expand Down