diff options
-rwxr-xr-x | arch-up | 67 | ||||
-rwxr-xr-x | update | 65 |
2 files changed, 65 insertions, 67 deletions
diff --git a/arch-up b/arch-up deleted file mode 100755 index 1ea8d72..0000000 --- a/arch-up +++ /dev/null @@ -1,67 +0,0 @@ -#! /bin/bash -RESET="\033[0m" -RED="\033[0;31m" -CYAN="\033[0;36m" - -function run() { - echo -e "$CYAN $1 $RESET" && $1 -} - -function sudo_run() { - echo -e "$RED sudo$CYAN $1 $RESET" && sudo $1 -} - -function update_gem() { - # ls -1 .gem/ruby/2.2.0/specifications/ | sed 's/-\([0-9]\+\.\)\+gemspec//' | while read gem; do gem install $gem; done - - sudo_run "rm -fr /usr/lib/ruby/gems/*" - run "/usr/bin/gem update --no-document" - run "/usr/bin/gem clean" - # run "/opt/ruby1.8/bin/gem update" - # run "/opt/ruby1.8/bin/gem clean" -} - -function update_pkgs() { - sudo_run "pacman -Syu" || return - sudo_run "pacman -Scc --noconfirm" - sudo_run "rm /var/cache/pacman/pkg/*" - run "aurget -Syu" -} - -function update_makepkg () { - pkg=$1 - src_dir=$2 - base=~/local - if [ -d $base/$pkg/src/$src_dir ]; then - echo -e "$CYAN update $pkg $RESET" - cd $base/$pkg/src/$src_dir - if [ $(git pull | grep Already | wc -l) -ne 0 ]; then - echo "$pkg is Already up-to-date" - else - cd $base/$pkg/ - rm *.pkg.tar.xz 2>/dev/null - makepkg && sudo_run "pacman -Uf --noconfirm $pkg*.pkg.tar.xz" - fi - else - echo "~/local/$pkg/src/$src_dir does not exists" - fi -} - -function update_e17() { - run "easy_e17.sh -u --sudopwd=$PASSWD $@" - # sudo_run "find /opt/e17 -mtime +30 ! -type d -exec rm '{}' \;" - if [ -e ~/local/eperiodique ]; then - cd ~/local/eperiodique - if [ $(git pull | grep Already | wc -l) -ne 1 ]; then - echo "update eperiodique" && ./autogen.sh --prefix=/usr >/dev/null && make >/dev/null && sudo make install >/dev/null - fi - fi -} - -function check_etc_git() { - [ -e /etc/.git ] || return - run "cd /etc" - sudo_run "find . -name *.pacnew" - sudo_run "git status" -} - @@ -0,0 +1,65 @@ +#! /bin/bash +RESET="\033[0m" +RED="\033[0;31m" +CYAN="\033[0;36m" + +if [ $# -lt 1 ]; then + echo "missing passwd" && exit 1 +fi +sudo -K +echo "$1" | sudo -S true &>/dev/null +if [ $? -ne 0 ]; then + echo "wrong sudo passwd" && exit 1 +fi +PASSWD=$1 +shift + +function run() { + echo -e "$CYAN $1 $RESET" && $1 +} + +function sudo_run() { + echo -e "$RED sudo$CYAN $1 $RESET" && sudo $1 +} + +function update_gem() { + # ls -1 .gem/ruby/2.2.0/specifications/ | sed 's/-\([0-9]\+\.\)\+gemspec//' | while read gem; do gem install $gem; done + sudo_run "rm -fr /usr/lib/ruby/gems/*" + run "/usr/bin/gem update --no-document" + run "/usr/bin/gem clean" +} + +function update_pkgs() { + sudo_run "pacman -Syu" || return + sudo_run "pacman -Scc --noconfirm" + sudo_run "rm /var/cache/pacman/pkg/*" + run "aurget -Syu" +} + +function check_etc() { + sudo_run "find /etc -name *.pacnew" + [ -e /etc/.git ] || return + run "cd /etc" + sudo_run "git status" +} + +function synk() { + [ -f ~/etc/liferea/liferea.db-* ] && rm ~/etc/liferea/liferea.db-* + [ -f ~/.googleearth/myplaces.kml ] && cp ~/.googleearth/myplaces.kml ~/etc/googleearth + [ -f ~/.unison/asynk.prf ] && echo -e "$RED ** unison asynk $RESET" && unison asynk.prf +} + +function git_pull() { + pushd $1 >/dev/null || return + run "git pull --rebase" || echo -e "$RED FAILED in : $(pwd) $RESET" + pushd +} + +synk +git_pull ~/usr/git/bin +git_pull ~/usr/git/vim +update_pkgs +update_gem +check_etc + +sudo -K |