个人工具

“UbuntuHelp:EasyUbuntuInstallationScript”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
 
(未显示同一用户的7个中间版本)
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/EasyUbuntuInstallationScript}}
 
{{From|https://help.ubuntu.com/community/EasyUbuntuInstallationScript}}
 
{{Languages|UbuntuHelp:EasyUbuntuInstallationScript}}
 
{{Languages|UbuntuHelp:EasyUbuntuInstallationScript}}
 +
<<Include(Tag/Deletion)>>
 
=== Purpose ===
 
=== Purpose ===
This is a a bash script that attempts to further automate the installation of EasyUbuntu
+
This is a a bash script that attempts to further automate the installation of [[UbuntuHelp:EasyUbuntu|EasyUbuntu]]
 
on a Ubuntu system, to make it even easier for the end-user than the "official"
 
on a Ubuntu system, to make it even easier for the end-user than the "official"
 
[http://easyubuntu.freecontrib.org/get.html installation instructions]
 
[http://easyubuntu.freecontrib.org/get.html installation instructions]
第9行: 第10行:
 
1. Open a terminal window
 
1. Open a terminal window
 
2. Paste the following commands (note that the wget cmd is one long line)
 
2. Paste the following commands (note that the wget cmd is one long line)
 +
 
<pre><nowiki>
 
<pre><nowiki>
 
cd /tmp
 
cd /tmp
 +
 
wget -O install_easyubuntu.sh "https://help.ubuntu.com/community/EasyUbuntuInstallationScript?action=AttachFile&do=get&target=install_easyubuntu.sh"
 
wget -O install_easyubuntu.sh "https://help.ubuntu.com/community/EasyUbuntuInstallationScript?action=AttachFile&do=get&target=install_easyubuntu.sh"
 +
 
sh install_easyubuntu.sh
 
sh install_easyubuntu.sh
 
</nowiki></pre>
 
</nowiki></pre>
 
3. Follow the prompts
 
3. Follow the prompts
 +
 
==== The same, but more steps ====
 
==== The same, but more steps ====
 
1. Open your favorite text editor
 
1. Open your favorite text editor
 
2. Paste the code below
 
2. Paste the code below
 +
 
<pre><nowiki>
 
<pre><nowiki>
 
#!/bin/sh
 
#!/bin/sh
 +
 
# This is a a bash script that attempts to further automate the installation of EasyUbuntu
 
# This is a a bash script that attempts to further automate the installation of EasyUbuntu
 
# on a Ubuntu system, so that the end-user have fewer steps to follow than  
 
# on a Ubuntu system, so that the end-user have fewer steps to follow than  
第31行: 第38行:
 
#  IH: 17-Oct-2006 - initial version
 
#  IH: 17-Oct-2006 - initial version
 
#
 
#
 +
 
# the name of the package (and executable)
 
# the name of the package (and executable)
 
BIN=easyubuntu
 
BIN=easyubuntu
 +
 +
 
# create a tmp folder
 
# create a tmp folder
 
TMP=/tmp/easyubuntu_installer
 
TMP=/tmp/easyubuntu_installer
 
mkdir -p $TMP
 
mkdir -p $TMP
 
cd $TMP
 
cd $TMP
 +
 
# Check to see if easyubuntu is already installed
 
# Check to see if easyubuntu is already installed
 
# we have to check for status installed, because it can be purged (or uninstalled) and then the status is
 
# we have to check for status installed, because it can be purged (or uninstalled) and then the status is
第47行: 第58行:
 
exit 1
 
exit 1
 
fi
 
fi
 +
 +
 
# Hint to the user in case she gets a password prompt
 
# Hint to the user in case she gets a password prompt
 
echo "Please, provide your password for sudo if prompted."
 
echo "Please, provide your password for sudo if prompted."
 +
 
# Download and import GPG key (if not done already)
 
# Download and import GPG key (if not done already)
 
sudo apt-key list | grep -q "pub  1024D/969F3F57 2005-02-15"
 
sudo apt-key list | grep -q "pub  1024D/969F3F57 2005-02-15"
第63行: 第77行:
 
exit $RETVAL
 
exit $RETVAL
 
fi
 
fi
 +
 
cat easyubuntu_public_key.gpg | sudo apt-key add -
 
cat easyubuntu_public_key.gpg | sudo apt-key add -
 
RETVAL=$?
 
RETVAL=$?
第70行: 第85行:
 
fi
 
fi
 
fi
 
fi
 +
 
# make a backup of sources
 
# make a backup of sources
 
TIMESTAMP=`date +%Y%m%d_%H%M`
 
TIMESTAMP=`date +%Y%m%d_%H%M`
 
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup_$TIMESTAMP
 
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup_$TIMESTAMP
 +
 
# add the easyubuntu repository to sources (if not already there)
 
# add the easyubuntu repository to sources (if not already there)
 
AUTO_REPO_TO_ADD="deb http://easyubuntu.cafuego.net main easyubuntu"
 
AUTO_REPO_TO_ADD="deb http://easyubuntu.cafuego.net main easyubuntu"
第85行: 第102行:
 
sudo cp $TMP/repo /etc/apt/sources.list
 
sudo cp $TMP/repo /etc/apt/sources.list
 
fi
 
fi
 +
 
# update the repos
 
# update the repos
 
echo " ... Updating apt repositories cache. This might take a minute or two (output is redirected to a log file) ... "
 
echo " ... Updating apt repositories cache. This might take a minute or two (output is redirected to a log file) ... "
 +
 
# we will redirect the output to a log file for the sake of not cluttering the output
 
# we will redirect the output to a log file for the sake of not cluttering the output
 
APT_LOG=$TMP/apt-get-update.log
 
APT_LOG=$TMP/apt-get-update.log
第97行: 第116行:
 
exit $RETVAL
 
exit $RETVAL
 
fi
 
fi
 +
 
# finally install EasyUbuntu
 
# finally install EasyUbuntu
 
sudo apt-get install $BIN
 
sudo apt-get install $BIN
第104行: 第124行:
 
exit $RETVAL
 
exit $RETVAL
 
fi
 
fi
 +
 
echo "-----"
 
echo "-----"
 
echo "Installation of $BIN is successful."
 
echo "Installation of $BIN is successful."
 +
 
# Do you want to launch EasyUbuntu ?
 
# Do you want to launch EasyUbuntu ?
 
echo "Would you like to start EasyUbuntu now ?"
 
echo "Would you like to start EasyUbuntu now ?"
第113行: 第135行:
 
break
 
break
 
done
 
done
 +
 
if [ "Yes" = "$USER_SELECTION" ]; then
 
if [ "Yes" = "$USER_SELECTION" ]; then
 
echo " ... starting 'sudo $BIN' ... "
 
echo " ... starting 'sudo $BIN' ... "
 
sudo $BIN &
 
sudo $BIN &
 
fi
 
fi
 +
 
exit $?
 
exit $?
 
</nowiki></pre>
 
</nowiki></pre>
 
3. Save it as the file /tmp/install_easyubuntu.sh
 
3. Save it as the file /tmp/install_easyubuntu.sh
 
4. Open a terminal and execute it
 
4. Open a terminal and execute it
 +
 
<pre><nowiki>
 
<pre><nowiki>
 
sh /tmp/install_easyubuntu.sh
 
sh /tmp/install_easyubuntu.sh
 
</nowiki></pre>
 
</nowiki></pre>
 
5. Follow the prompts
 
5. Follow the prompts
 +
 
=== Notes ===
 
=== Notes ===
 
1. You might have to provide your password for sudo when administrative privileges are required
 
1. You might have to provide your password for sudo when administrative privileges are required
 
2. The script has only been tested in XUbuntu 6.06. Please, modify this page detailing your problems (and solutions) if you find any.
 
2. The script has only been tested in XUbuntu 6.06. Please, modify this page detailing your problems (and solutions) if you find any.
 
3. I am no shell guru, so feel free to modify the script where you feel it will make it better. But, please do not modify just for the sake of brevity. Clarity is much more important.
 
3. I am no shell guru, so feel free to modify the script where you feel it will make it better. But, please do not modify just for the sake of brevity. Clarity is much more important.
4. This script is practically the same as AutomatixInstallationScript, except it's applied for EasyUbuntu, not [[UbuntuHelp:Automatix| Automatix]]
+
4. This script is practically the same as [[UbuntuHelp:AutomatixInstallationScript|AutomatixInstallationScript]], except it's applied for [[UbuntuHelp:EasyUbuntu|EasyUbuntu]], not [[UbuntuHelp:Automatix|Automatix]]
 +
 
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2008年12月16日 (二) 18:20的最新版本

<<Include(Tag/Deletion)>>

Purpose

This is a a bash script that attempts to further automate the installation of EasyUbuntu on a Ubuntu system, to make it even easier for the end-user than the "official" installation instructions

Steps to follow

Short version

1. Open a terminal window 2. Paste the following commands (note that the wget cmd is one long line)

cd /tmp

wget -O install_easyubuntu.sh "https://help.ubuntu.com/community/EasyUbuntuInstallationScript?action=AttachFile&do=get&target=install_easyubuntu.sh"

sh install_easyubuntu.sh

3. Follow the prompts

The same, but more steps

1. Open your favorite text editor 2. Paste the code below

#!/bin/sh

# This is a a bash script that attempts to further automate the installation of EasyUbuntu
# on a Ubuntu system, so that the end-user have fewer steps to follow than 
# the "official" installation instructions found at
#   http://easyubuntu.freecontrib.org/get.html
#
# This script is published on the Ubunutu help wiki at
#   https://help.ubuntu.com/community/EasyUbuntuInstallationScript
#
# Version history
#   IH: 17-Oct-2006 - initial version
#

# the name of the package (and executable)
BIN=easyubuntu


# create a tmp folder
TMP=/tmp/easyubuntu_installer
mkdir -p $TMP
cd $TMP

# Check to see if easyubuntu is already installed
# we have to check for status installed, because it can be purged (or uninstalled) and then the status is
#   Status: purge ok not-installed
dpkg -s $BIN | grep -q "Status: install ok installed" > /dev/null 2>&1
if [ $? -eq 0 ]; then
	echo "ERROR: Package $BIN is already installed."
	echo "  If you want to upgrade (or remove) the package use the standard apt-get/dpkg tools"
	echo "  Installation is aborted."
	exit 1
fi


# Hint to the user in case she gets a password prompt
echo "Please, provide your password for sudo if prompted."

# Download and import GPG key (if not done already)
sudo apt-key list | grep -q "pub   1024D/969F3F57 2005-02-15"
if [ $? -eq 0 ]; then
	echo "Note: easyubuntu signing key already in apt-key repo. Not adding it."
else
	#wget http://easyubuntu.cafuego.net/969F3F57.gpg -O - | sudo apt-key add -
	wget http://easyubuntu.cafuego.net/969F3F57.gpg -O easyubuntu_public_key.gpg >/dev/null 2>&1
	RETVAL=$?
	if [ $RETVAL -ne 0 ]; then
		echo "ERROR: Failed to download signing key. Aborting."
		echo "  The cmd that caused the error was: "
		echo "    wget http://easyubuntu.cafuego.net/969F3F57.gpg -O easyubuntu_public_key.gpg"
		exit $RETVAL
	fi
	
	cat easyubuntu_public_key.gpg | sudo apt-key add -
	RETVAL=$?
	if [ $RETVAL -ne 0 ]; then
		echo "ERROR: Failed to import signing key. Aborting."
		exit $RETVAL
	fi
fi

# make a backup of sources
TIMESTAMP=`date +%Y%m%d_%H%M`
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup_$TIMESTAMP

# add the easyubuntu repository to sources (if not already there)
AUTO_REPO_TO_ADD="deb http://easyubuntu.cafuego.net main easyubuntu"
grep -v ^#  /etc/apt/sources.list | grep -q "$AUTO_REPO_TO_ADD"
if [ $? -eq 0 ]; then
	echo "Note: easyubuntu repository already in /etc/apt/sources.list. Not adding it."
else
	# sudo on redirection don't mesh well, so we need a buffer file
	> $TMP/repo
	cat /etc/apt/sources.list > $TMP/repo
	echo "$AUTO_REPO_TO_ADD" >> $TMP/repo
	sudo cp $TMP/repo /etc/apt/sources.list
fi

# update the repos
echo " ... Updating apt repositories cache. This might take a minute or two (output is redirected to a log file) ... "

# we will redirect the output to a log file for the sake of not cluttering the output
APT_LOG=$TMP/apt-get-update.log
sudo apt-get update > $APT_LOG 2>&1
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
	echo "ERROR: apt-get update failed."
	echo "Check the log by typing"
	echo "  $ less $APT_LOG"
	exit $RETVAL
fi

# finally install EasyUbuntu
sudo apt-get install $BIN
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
	echo "ERROR: Installation of package $BIN failed."
	exit $RETVAL
fi

echo "-----"
echo "Installation of $BIN is successful."

# Do you want to launch EasyUbuntu ?
echo "Would you like to start EasyUbuntu now ?"
PS3="Choose (1-2): "
select USER_SELECTION in Yes No
do
	break
done

if [ "Yes" = "$USER_SELECTION" ]; then
	echo " ... starting 'sudo $BIN' ... "
	sudo $BIN &
fi

exit $?

3. Save it as the file /tmp/install_easyubuntu.sh 4. Open a terminal and execute it

sh /tmp/install_easyubuntu.sh

5. Follow the prompts

Notes

1. You might have to provide your password for sudo when administrative privileges are required 2. The script has only been tested in XUbuntu 6.06. Please, modify this page detailing your problems (and solutions) if you find any. 3. I am no shell guru, so feel free to modify the script where you feel it will make it better. But, please do not modify just for the sake of brevity. Clarity is much more important. 4. This script is practically the same as AutomatixInstallationScript, except it's applied for EasyUbuntu, not Automatix