个人工具

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

来自Ubuntu中文

跳转至: 导航, 搜索
第2行: 第2行:
 
{{Languages|UbuntuHelp:EasyUbuntuInstallationScript}}
 
{{Languages|UbuntuHelp:EasyUbuntuInstallationScript}}
 
=== 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]
第11行: 第11行:
 
<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/[[UbuntuHelp:EasyUbuntuInstallationScript|EasyUbuntuInstallationScript]]??action=AttachFile&do=get&target=install_easyubuntu.sh"
 
sh install_easyubuntu.sh
 
sh install_easyubuntu.sh
 
</nowiki></pre>
 
</nowiki></pre>
第20行: 第20行:
 
<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 [[UbuntuHelp:EasyUbuntu|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  
 
# the "official" installation instructions found at
 
# the "official" installation instructions found at
第26行: 第26行:
 
#
 
#
 
# This script is published on the Ubunutu help wiki at
 
# This script is published on the Ubunutu help wiki at
#  https://help.ubuntu.com/community/EasyUbuntuInstallationScript
+
#  https://help.ubuntu.com/community/[[UbuntuHelp:EasyUbuntuInstallationScript|EasyUbuntuInstallationScript]]
 
#
 
#
 
# Version history
 
# Version history
第97行: 第97行:
 
exit $RETVAL
 
exit $RETVAL
 
fi
 
fi
# finally install EasyUbuntu
+
# finally install [[UbuntuHelp:EasyUbuntu|EasyUbuntu]]
 
sudo apt-get install $BIN
 
sudo apt-get install $BIN
 
RETVAL=$?
 
RETVAL=$?
第106行: 第106行:
 
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 [[UbuntuHelp:EasyUbuntu|EasyUbuntu]] ?
echo "Would you like to start EasyUbuntu now ?"
+
echo "Would you like to start [[UbuntuHelp:EasyUbuntu|EasyUbuntu]] now ?"
 
PS3="Choose (1-2): "
 
PS3="Choose (1-2): "
 
select USER_SELECTION in Yes No
 
select USER_SELECTION in Yes No
第129行: 第129行:
 
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]]

2007年12月4日 (二) 10:26的版本

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/[[UbuntuHelp:EasyUbuntuInstallationScript|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 [[UbuntuHelp:EasyUbuntu|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/[[UbuntuHelp:EasyUbuntuInstallationScript|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 [[UbuntuHelp:EasyUbuntu|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 [[UbuntuHelp:EasyUbuntu|EasyUbuntu]] ?
echo "Would you like to start [[UbuntuHelp:EasyUbuntu|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