Author Topic: [wiki]Allservers script: Rank Mirrors, Upgrade System, Maintain Cache, rm db.lck  (Read 34534 times)

0 Members and 1 Guest are viewing this topic.

Offline handy

  • Global Moderator
  • *****
  • Posts: 5738
  • Desktop: Openbox 3.6.1-3 & Worker :)
  • GPU Card: intel...
  • GPU driver: open-source
  • Kernel: OpenBSD
  • Skill: Intermediate
[edit:] 18-7-2016 Included a new menu item Option [6.], to remove the db.lck file to recover from an interrupted pacman/yaourt upgrade attempt.

[edit:] 16-5-2015 Added the highlighted link to the Create your own Custom Mirrorlist on the Manjaro Wiki. In an effort to help anyone that doesn't know how to speed up their use of the:
[1] Option 1. - pacman-mirrors -g command.

Also: a day or two earlier I added the What about ALL of those other Pacman/AUR Terminal commands? Section, which is inconsequential beyond saying stuff that may or may not have needed to be said... ;)

[edit:] 2-4-2015: The upto date script will now be available from the Community repo. Rob said that he would get to it last night. In the future if there is a change to the script I'll let Rob know & he'll modify the package. Good stuff. :)

[edit:] 13-2-2015: Uploaded the modified script to the wiki (currently the script in the repo is out of date), see wiki page for details. Basically the allservers script on the wiki page is modified to work with the new version of pacman, those changes have been tested for a ~month & found to have no problems. I've also put the pacman --noconfirm option at the end of the command lines for Option [2] & [3] in the allservers menu (I've been using it that way for over a year now).

I cleaned up the wiki page here & there - modifying the content where appropriate.

[edit:] 12-2-2014: Cleaned up the menu, it is much cleaner now. Functionality remains unchanged. :)

[edit:] 17-11-2013:
Updated the script. Functionality remains unchanged, the menu has been improved both visually & is a little less ambiguous. The wiki page now has a tidier address also.

[edit:] 17-11-2013: Modified the Installation & Execution section & the Call sudo allservers.sh with just two letters section, the How to Edit Your ~/.bashrc & I added a couple of aliases to make creating aliases easier. Most of this wiki updating was long overdue.


I deleted the history that was here, it was just a waste of space.

PLEASE GO TO THE WIKI FOR THE CURRENT HOW-TO & SCRIPT:


The current script should now be in the Community repo, thanks to Rob.

If you have any problems, questions or improvements to offer, please post in this thread.
____________________________

« Last Edit: 18. July 2016, 08:19:10 by handy »
The ultimate tyranny in a society is not control
by martial law. It is control by the psychological
manipulation of consciousness, through which reality
is defined so that those who exist within do not even
realize that they are in prison.
  —  Barbara Marciniak

Offline handy

  • Global Moderator
  • *****
  • Posts: 5738
  • Desktop: Openbox 3.6.1-3 & Worker :)
  • GPU Card: intel...
  • GPU driver: open-source
  • Kernel: OpenBSD
  • Skill: Intermediate
Re: [How-To] Script & system mod's for Rankmirrors & associated...
« Reply #1 on: 24. December 2012, 11:27:13 »
If you are interested in the content of the above post you should look over here in the wiki as the information has been refined there:

http://wiki.manjaro.org/index.php?title=Allservers.sh_Script
« Last Edit: 17. November 2013, 05:00:53 by handy »
The ultimate tyranny in a society is not control
by martial law. It is control by the psychological
manipulation of consciousness, through which reality
is defined so that those who exist within do not even
realize that they are in prison.
  —  Barbara Marciniak

Offline dicktater

  • Held Mitglied
  • *****
  • Posts: 2056
  • Skill: Novice
Re: [How-To] Script & system mod's for Rankmirrors & associated...
« Reply #2 on: 24. December 2012, 18:38:16 »
Thanks for the refinements update, handy!
The Manjaro Forum Revised Rules  How to Report Issues Properly   Please Read the Manjaro Wiki

Offline philm

  • Core Team
  • *****
  • Posts: 10671
    • Manjaro Linux
  • Branch: Unstable
  • Desktop: XFCE
  • GPU Card: Geforce GTX 650
  • GPU driver: non-free
  • Kernel: Maintainer - so all ;)
  • Skill: Guru
Re: [How-To] Script & system mod's for Rankmirrors & associated...
« Reply #3 on: 25. December 2012, 01:31:23 »
This is really great script. Great teamwork  8)

Offline ringo

  • Held Mitglied
  • *****
  • Posts: 9684
  • www.manjaro-nl.org
    • Manjaro Belgium + forum
  • Branch: unsourced
  • Desktop: xfce
  • GPU Card: Nvidia Geforce 8600 GT (acer 23inch)
  • GPU driver: Free*
  • Kernel: linux kernel
  • Skill: Novice
Re: [How-To] Script & system mod's for Rankmirrors & associated...
« Reply #4 on: 25. December 2012, 01:53:53 »
is that script already availble in the new 0.83 iso?  or aka updater? on other distroś  like lmde they have like mint-mirrors  first update you can choose your mirrors and the speed of those more is behind...you can have also just 1 2 and 3 what fasters mirrors...


something like that. ? but that rankmirrors is that already in the new iso?
Dutch go the dutch site :)

Offline handy

  • Global Moderator
  • *****
  • Posts: 5738
  • Desktop: Openbox 3.6.1-3 & Worker :)
  • GPU Card: intel...
  • GPU driver: open-source
  • Kernel: OpenBSD
  • Skill: Intermediate
Re: [How-To] Script & system mod's for Rankmirrors & associated...
« Reply #5 on: 25. December 2012, 02:53:12 »
@ringo32: We just cobbled that script together inside of the last week.

If you want to use it just copy the script from this page to a new page in your text editor, & save it as allservers.sh into your /home directory & follow the how-to to make the allservers.sh file executable & if you want to be able to call it from the Terminal by typing in just two letters = as you will have to copy the alias (also found in the how-to, into your /home/.bashrc ). If you don't copy the alias into your .bashrc , then in the Terminal you will first have to type in sudo su followed by allservers.sh to run the script.

I'll get around to adding more instructions to the wiki that goes through the steps of installing the script & the .bashrc alias onto a users computer.


[edit:] Removed inapplicable content. :)
« Last Edit: 26. December 2012, 00:32:17 by handy »
The ultimate tyranny in a society is not control
by martial law. It is control by the psychological
manipulation of consciousness, through which reality
is defined so that those who exist within do not even
realize that they are in prison.
  —  Barbara Marciniak

Offline handy

  • Global Moderator
  • *****
  • Posts: 5738
  • Desktop: Openbox 3.6.1-3 & Worker :)
  • GPU Card: intel...
  • GPU driver: open-source
  • Kernel: OpenBSD
  • Skill: Intermediate
Re: [How-To] Script & system mod's for Rankmirrors & associated...
« Reply #6 on: 25. December 2012, 04:35:10 »
I have added more detail to the allservers.sh wiki page with regards to the using of a text editor to create the allservers.sh script & also the editing of the ~/.bashrc file.

I haven't finished with the wiki page yet, it will get tidier & a tad more informative in the not too distant future.

http://wiki.manjaro.org/index.php?title=Allservers.sh_Script
« Last Edit: 17. November 2013, 05:01:23 by handy »
The ultimate tyranny in a society is not control
by martial law. It is control by the psychological
manipulation of consciousness, through which reality
is defined so that those who exist within do not even
realize that they are in prison.
  —  Barbara Marciniak

Offline handy

  • Global Moderator
  • *****
  • Posts: 5738
  • Desktop: Openbox 3.6.1-3 & Worker :)
  • GPU Card: intel...
  • GPU driver: open-source
  • Kernel: OpenBSD
  • Skill: Intermediate
Re: [How-To] Script & system mod's for Rankmirrors & associated...
« Reply #7 on: 25. December 2012, 07:23:32 »
I've modified the allservers.sh script, it now has a menu come up after the rankmirrors & package database sync.

The script will be cleaned up a bit, but I just had to post it, as it is quite exciting for me to have made the breakthrough into "menu's". lol

By the way, what this script now does is exactly what the old one does, THEN, it puts up a menu asking you how you want to upgrade your system like so:

Code: [Select]

               allservers.sh
               -------------
    Choose how you want to upgrade Manjaro?


    [S]ystem Only --> pacman -Syu

    [A]UR & System --> yaourt -Syu --aur

    Hit Return to Exit the script


[handy@jarmano ~]$

For those that are already using the script, there is no need to change your alias, just replace the previous script with this one. 

Here's the new allservers.sh:

Code: [Select]
#!/bin/bash

# allservers.sh - inspired by Manjaro's Carl & Phil, initially hung together
# by handy, the script's display prettied up & progress information added by Phil,
# the menu added by handy, as was the wiki page:
# http://wiki.manjaro.org/index.php?title=Allservers.sh_Script
 
# allservers.menu.sh MUST be run as root = after sudo su
# 1. Downloads the most recent Manjaro mirror list to /etc/pacman.d/allservers
# 2. Formats it to /etc/pacman.d/allservers
# 3. Rankmirrors tests then updates /etc/pacman.d/mirrorlist
# 4. Syncs the mirrors with your machine
# 5. Menu appears asking you how you want to upgrade your system.
#    Choice 1. type s or S to call pacman -Syu
#    Choice 2. type a or A to call yaourt -Syu --aur
#    Hit Return to exit the script.


err() {
    ALL_OFF="\e[1;0m"
    BOLD="\e[1;1m"
    RED="${BOLD}\e[1;31m"
   local mesg=$1; shift
   printf "${RED}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}

msg() {
    ALL_OFF="\e[1;0m"
    BOLD="\e[1;1m"
    GREEN="${BOLD}\e[1;32m"
   local mesg=$1; shift
   printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}

if [[ `whoami` != "root" ]];
then
  err "Must use 'sudo su' before you run this script."
  exit
fi

msg "Downloading latest mirrorlist"
wget http://git.manjaro.org/packages-sources/basis/blobs/raw/master/pacman-mirrorlist/mirrorlist -O /etc/pacman.d/allservers >& /dev/null
msg "Editing allservers file"
sed -ie s'/# Server/Server/'g /etc/pacman.d/allservers
msg "Running rankmirrors"
rankmirrors -n 3 /etc/pacman.d/allservers > /etc/pacman.d/mirrorlist
msg "Updating your pacman databases"
pacman -Syy


# menu options to upgrade system & upgrade system plus AUR:

clear # Clear the screen.

echo
echo "               allservers.sh"
echo "               -------------"
echo "    Choose how you want to upgrade Manjaro?"
echo
echo
echo "    [S]ystem Only --> pacman -Syu"
echo
echo "    [A]UR & System --> yaourt -Syu --aur"
echo
echo "    Hit Return to Exit the script"
echo

read option

case "$option" in
# Note variable is quoted.

  "S" | "s" )
  # Accept upper or lowercase input.
  echo
  pacman -Syu
  msg "System update complete"
  ;;
# Note double semicolon to terminate each option.

  "A" | "a" )
  echo "Upgrading System & AUR."
  yaourt -Syu --aur
  msg "System including AUR packages are up to date."
  ;;

esac

echo

exit 0


[edit:] The script has been cleaned up some since it was originally posted.

[edit2:] The allservers.sh wiki page has been bought up to date:

http://wiki.manjaro.org/index.php?title=Allservers.sh_Script
« Last Edit: 17. November 2013, 05:02:17 by handy »
The ultimate tyranny in a society is not control
by martial law. It is control by the psychological
manipulation of consciousness, through which reality
is defined so that those who exist within do not even
realize that they are in prison.
  —  Barbara Marciniak

Offline ringo

  • Held Mitglied
  • *****
  • Posts: 9684
  • www.manjaro-nl.org
    • Manjaro Belgium + forum
  • Branch: unsourced
  • Desktop: xfce
  • GPU Card: Nvidia Geforce 8600 GT (acer 23inch)
  • GPU driver: Free*
  • Kernel: linux kernel
  • Skill: Novice
Re: [How-To] Script & system mod's for Rankmirrors & associated...
« Reply #8 on: 25. December 2012, 08:54:50 »
thanx ;D i only want to know :) nice script :); last week i had reinstall my system cayse of my own fault offcourse... nevermind but i did find the scrip, was as your name Handy :)

i where only questionng about, is nice script.
:)

gr ringo
Dutch go the dutch site :)

Offline handy

  • Global Moderator
  • *****
  • Posts: 5738
  • Desktop: Openbox 3.6.1-3 & Worker :)
  • GPU Card: intel...
  • GPU driver: open-source
  • Kernel: OpenBSD
  • Skill: Intermediate
Re: [How-To] Script & system mod's for Rankmirrors & associated...
« Reply #9 on: 25. December 2012, 10:39:56 »
Cleaned up the script in my previous post, let me know what you think?

I expect that I'll change the name from allservers.menu.sh to the original name allservers.sh .


@Ringo32: Thanks. :)
The ultimate tyranny in a society is not control
by martial law. It is control by the psychological
manipulation of consciousness, through which reality
is defined so that those who exist within do not even
realize that they are in prison.
  —  Barbara Marciniak

Offline eskaini

  • Security Team
  • *****
  • Posts: 10842
  • I eat deleted accounts
  • Skill: Novice
Re: [How-To] Script & system mod's for Rankmirrors & associated...
« Reply #10 on: 25. December 2012, 11:06:48 »
Cleaned up the script in my previous post, let me know what you think?

I expect that I'll change the name from allservers.menu.sh to the original name allservers.sh .


@Ringo32: Thanks. :)

You've put a lot of time and effort into this Handy - very pleased to have you aboard, my friend!

Offline ringo

  • Held Mitglied
  • *****
  • Posts: 9684
  • www.manjaro-nl.org
    • Manjaro Belgium + forum
  • Branch: unsourced
  • Desktop: xfce
  • GPU Card: Nvidia Geforce 8600 GT (acer 23inch)
  • GPU driver: Free*
  • Kernel: linux kernel
  • Skill: Novice
Re: [How-To] Script & system mod's for Rankmirrors & associated...
« Reply #11 on: 25. December 2012, 11:12:35 »
did try the script :) is even better for sure!
 im sure in the next iso version is very handy!


:p
Dutch go the dutch site :)

Offline handy

  • Global Moderator
  • *****
  • Posts: 5738
  • Desktop: Openbox 3.6.1-3 & Worker :)
  • GPU Card: intel...
  • GPU driver: open-source
  • Kernel: OpenBSD
  • Skill: Intermediate
Re: [How-To] Script & system mod's for Rankmirrors & associated...
« Reply #12 on: 25. December 2012, 11:54:30 »
I've just modified the allservers.sh wiki page & bought it up to date. I've kept the name of the original script, so it is still called allservers.sh & it still uses the same .bashrc alias of as on my computer & the wiki at least. :)

I'll go back & edit my previous post so that allservers.sh is the consistent name, you never know it may save some confusion somewhere some time...

@ringo32: thanks again mate. :)
« Last Edit: 25. December 2012, 12:31:38 by handy »
The ultimate tyranny in a society is not control
by martial law. It is control by the psychological
manipulation of consciousness, through which reality
is defined so that those who exist within do not even
realize that they are in prison.
  —  Barbara Marciniak

Offline handy

  • Global Moderator
  • *****
  • Posts: 5738
  • Desktop: Openbox 3.6.1-3 & Worker :)
  • GPU Card: intel...
  • GPU driver: open-source
  • Kernel: OpenBSD
  • Skill: Intermediate
Re: [How-To] Script & system mod's for Rankmirrors & associated...
« Reply #13 on: 26. December 2012, 00:45:04 »
I'd say that the allservers.sh script is now complete. And the wiki page is up to date:

http://wiki.manjaro.org/index.php?title=Allservers.sh_Script

The only thing anyone may want to do with it is change the yaourt line to use packer or one of the other pacman wrappers.

Here is the script:

Code: [Select]
#!/bin/bash

# allservers.sh - inspired by Manjaro's Carl & Phil, initially hung together
# by handy, the script's display prettied up & progress information added by Phil,
# the menu & wiki page added by handy:
# http://wiki.manjaro.org/index.php/Allservers.sh_Script:-_Rankmirrors,_Synchronise_Pacman_Database
 
# allservers.menu.sh MUST be run as root = after sudo su
# 1. Downloads the most recent Manjaro mirror list to /etc/pacman.d/allservers
# 2. Formats it to /etc/pacman.d/allservers
# 3. Rankmirrors tests then updates /etc/pacman.d/mirrorlist with the 3 fastest
# 4. Syncs the mirrors with your machine
# 5. Menu then appears asking you how you want to upgrade your system.
#    Choice 1. type s or S to call pacman -Syu
#    Choice 2. type a or A to call yaourt -Syu --aur
#    Hit Return to exit the script.
###########################################################

err() {
    ALL_OFF="\e[1;0m"
    BOLD="\e[1;1m"
    RED="${BOLD}\e[1;31m"
   local mesg=$1; shift
   printf "${RED}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}

msg() {
    ALL_OFF="\e[1;0m"
    BOLD="\e[1;1m"
    GREEN="${BOLD}\e[1;32m"
   local mesg=$1; shift
   printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}


if [[ `whoami` != "root" ]];
then
  err "Must use 'sudo su' before you run this script."
  exit
fi

msg "Downloading latest mirrorlist"
wget http://git.manjaro.org/packages-sources/basis/blobs/raw/master/pacman-mirrorlist/mirrorlist -O /etc/pacman.d/allservers >& /dev/null
msg "Editing allservers file"
sed -ie s'/# Server/Server/'g /etc/pacman.d/allservers
msg "Running rankmirrors"
rankmirrors -n 3 /etc/pacman.d/allservers > /etc/pacman.d/mirrorlist
msg "Updating your pacman databases"
pacman -Syy


# menu options to upgrade system & upgrade system plus AUR:

clear # Clear the screen.

echo
echo -e "\033[1m                 allservers.sh \033[0m"
echo
echo -e "\e[1;32m    Choose how you want to upgrade Manjaro?"
echo  "    Choose the S/s or A/a key - or -->"
echo  "    Hit the Return/Enter key to Exit the script."
echo
echo
echo  "    [S]ystem Only --> pacman -Syu"
echo
echo -e "    [A]UR & System --> yaourt -Syu --aur  \e[1;0m"
echo
#echo -e "    Hit Return to Exit the script \e[1;0m"
echo

read option

case "$option" in
# Note variable is quoted.

  "S" | "s" )
  # Accept upper or lowercase input.
  echo
  pacman -Syu
  msg "System update complete"
  ;;
# Note double semicolon to terminate each option.

  "A" | "a" )
  echo "Upgrading System & AUR."
  yaourt -Syu --aur
  msg "System including AUR packages are up to date."
  ;;

esac

echo

exit 0


Here's a screenshot of the Menu:
« Last Edit: 17. November 2013, 05:02:42 by handy »
The ultimate tyranny in a society is not control
by martial law. It is control by the psychological
manipulation of consciousness, through which reality
is defined so that those who exist within do not even
realize that they are in prison.
  —  Barbara Marciniak

Offline handy

  • Global Moderator
  • *****
  • Posts: 5738
  • Desktop: Openbox 3.6.1-3 & Worker :)
  • GPU Card: intel...
  • GPU driver: open-source
  • Kernel: OpenBSD
  • Skill: Intermediate
Re: [How-To] Script & system mod's for Rankmirrors & associated...
« Reply #14 on: 29. December 2012, 02:28:11 »
Use the wiki:  http://wiki.manjaro.org/index.php?title=Allservers.sh_Script

I've improved the output of the script, as I can't modify the OP now (too much time has gone by, which is a REAL problem for some of these how-to's you know).

So I'll post it here & update the wiki page which is really where people should go if they want to use most of the how-to's as they are laid out better, more up to date, & easier to navigate.

allservers.sh with prettier output:

Code: [Select]
#!/bin/bash

# allservers.sh - inspired by Manjaro's Carl & Phil, initially hung together
# by handy, the script's display prettied up & progress information added by Phil,
# the menu & wiki page added by handy:
# http://wiki.manjaro.org/index.php?title=Allservers.sh_Script
 
# allservers.menu.sh MUST be run as root = after sudo su
# 1. Downloads the most recent Manjaro mirror list to /etc/pacman.d/allservers
# 2. Formats it to /etc/pacman.d/allservers
# 3. Rankmirrors tests then updates /etc/pacman.d/mirrorlist with the 3 fastest
# 4. Syncs the mirrors with your machine
# 5. Menu then appears asking you how you want to upgrade your system.
#    Choice 1. type s or S to call pacman -Syu
#    Choice 2. type a or A to call yaourt -Syu --aur
#    Hit Return to exit the script.
###########################################################

err() {
    ALL_OFF="\e[1;0m"
    BOLD="\e[1;1m"
    RED="${BOLD}\e[1;31m"
   local mesg=$1; shift
   printf "${RED}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}

msg() {
    ALL_OFF="\e[1;0m"
    BOLD="\e[1;1m"
    GREEN="${BOLD}\e[1;32m"
   local mesg=$1; shift
   printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}


if [[ `whoami` != "root" ]];
then
  err "Must use 'sudo su' before you run this script."
  exit
fi

echo
msg "Downloading latest mirrorlist"
wget http://git.manjaro.org/packages-sources/basis/blobs/raw/master/pacman-mirrorlist/mirrorlist -O /etc/pacman.d/allservers >& /dev/null
msg "Editing allservers file"
sed -ie s'/# Server/Server/'g /etc/pacman.d/allservers
msg "Running rankmirrors"
rankmirrors -n 3 /etc/pacman.d/allservers > /etc/pacman.d/mirrorlist
msg "Updating your pacman databases"
echo
pacman -Syy


# menu options to upgrade system & upgrade system plus AUR:

clear # Clear the screen.

echo
echo -e "\033[1m                 allservers.sh \033[0m"
echo
echo -e "\e[1;32m    Choose how you want to upgrade Manjaro?"
echo  "    Choose the S/s or A/a key - or -->"
echo  "    Hit the Return/Enter key to Exit the script."
echo
echo
echo  "    [S]ystem Only --> pacman -Syu"
echo
echo -e "    [A]UR & System --> yaourt -Syu --aur  \e[1;0m"
echo
#echo -e "    Hit Return to Exit the script \e[1;0m"
echo

read option

case "$option" in
# Note variable is quoted.

  "S" | "s" )
  # Accept upper or lowercase input.
  echo
  msg "Upgrading System:"
  echo
  pacman -Syu
  echo
  msg "System update complete."
  ;;
# Note double semicolon to terminate each option.

  "A" | "a" )
  # Accept upper or lowercase input.
  echo
  msg "Upgrading System & AUR:"
  echo
  yaourt -Syu --aur
  echo
  msg "System including AUR packages are up to date."
  ;;

esac

echo

exit 0

I've attached two screenshots:

The first is what the output looks like after typing as at the prompt - up to the point where the system upgrade menu appears.

The second is from the upgrade menu after choosing option a to the end of the script. My system was up to date at the time, so there was no downloading &/or compilation going on = much shorter & tidier picture.
« Last Edit: 17. November 2013, 05:03:16 by handy »
The ultimate tyranny in a society is not control
by martial law. It is control by the psychological
manipulation of consciousness, through which reality
is defined so that those who exist within do not even
realize that they are in prison.
  —  Barbara Marciniak