0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Debian系、RedHat系Linux、MacOSXでパッケージ更新、インストールを共通のスクリプトで実行

Last updated at Posted at 2019-04-26

##概要
~/bin/のスクリプトを管理サーバ群(Debian, Raspbian, Ubuntu, CentOS, MacOSX)で同期させているため、パッケージの更新を一つのスクリプトで対応させた。それぞれ、apt-get, yum, brewの存在を確認して実行しているだけのスクリプトです。

##環境

  • サーバ群:Ubuntu, Debian, CentOS, MacOS, Raspbian

##スクリプト

#!/bin/bash
APTGET="/usr/bin/apt-get"
YUM="/usr/bin/yum"
BREW="/usr/local/bin/brew"

if [ -x $APTGET ]; then
    sudo apt-get update
    sudo apt-get -y upgrade
    sudo apt-get -y autoremove
elif [ -x $YUM ]; then
    sudo yum update
    sudo yum -y upgrade
    sudo yum -y autoremove
elif [ -x $BREW ]; then
    brew update
    brew upgrade
fi    

巡回スクリプトでも使いやすいようにsudoでパスワード入力を行わないように設定している。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?