特殊:Badtitle/NS100:EasyUbuntuInstallationScript:修订间差异

来自Ubuntu中文
跳到导航跳到搜索
Wikibot留言 | 贡献
无编辑摘要
Wikibot留言 | 贡献
无编辑摘要
第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/EasyUbuntuInstallationScript?action=AttachFile&do=get&target=install_easyubuntu.sh"
sh install_easyubuntu.sh
sh install_easyubuntu.sh
</nowiki></pre>
</nowiki></pre>
第20行: 第22行:
<pre><nowiki>
<pre><nowiki>
#!/bin/sh
#!/bin/sh
# This is a a bash script that attempts to further automate the installation of [[UbuntuHelp:EasyUbuntu|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  
# the "official" installation instructions found at
# the "official" installation instructions found at
第31行: 第34行:
#  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行: 第54行:
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行: 第73行:
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行: 第81行:
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行: 第98行:
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行: 第112行:
exit $RETVAL
exit $RETVAL
fi
fi
# finally install [[UbuntuHelp:EasyUbuntu|EasyUbuntu]]
 
# finally install EasyUbuntu
sudo apt-get install $BIN
sudo apt-get install $BIN
RETVAL=$?
RETVAL=$?
第104行: 第120行:
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 [[UbuntuHelp:EasyUbuntu|EasyUbuntu]] ?
 
echo "Would you like to start [[UbuntuHelp:EasyUbuntu|EasyUbuntu]] now ?"
# Do you want to launch EasyUbuntu ?
echo "Would you like to start EasyUbuntu now ?"
PS3="Choose (1-2): "
PS3="Choose (1-2): "
select USER_SELECTION in Yes No
select USER_SELECTION in Yes No
第113行: 第131行:
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>

2007年12月6日 (四) 10:12的版本

{{#ifexist: :EasyUbuntuInstallationScript/zh | | {{#ifexist: EasyUbuntuInstallationScript/zh | | {{#ifeq: {{#titleparts:EasyUbuntuInstallationScript|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:EasyUbuntuInstallationScript|1|-1|}} | zh | | }}

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