[原创脚本] 零起步创建自己的Archlive——基于Arch GNU/Linux的发行版
时间:2009-09-07
来源:互联网
为了简化定制的难度, 今天写个自动化创建的脚本如下:
(脚本随时更新于http://archlive.googlecode.com/hg/sm...build_archlive)
希望大家定制出自己喜欢的archlive。。。
#!/bin/bash
#
######################################################################################
# Author: Carbon Jiao <http://archlive.googlecode.com> <http://archlive-pkg.googlecode.com>
# Write this scripts to simplify the procedure of make your own Live system (LiveHD LiveUSB
# or LiveCD) with mkarchlive scripts.
# 作者 Carbon Jiao <http://archlive.googlecode.com><http://archlive-pkg.googlecode.com>
# 写该脚本的目的是为了简化 使用mkarchlive脚本制作自己的基于Arch GNU/Linux的Live系统(LiveHD
# LiveUSB or LiveCD)的过程.
# 2009-09-07 1st Revision
######################################################################################
#
#
APPNAME=$(basename "${0}")
cmdline=$@
# Checking the envirment...
# 检查语言环境
lang=$(locale | grep LANG | awk -F "=" '{print $2}')
# Default value, you can use "-r <workdir>" to change it.
# 默认工作目录, 可以使用 -r <workdir> 来更改.
workdir="/$(date +%m%d)"
usage (){
echo ""
if [ "${lang%_*}x" = "zhx" ]; then
echo "用法: sh ./${APPNAME} [选项]"
echo "选项:"
echo " -r <workdir> workdir为工作目录——本脚本所有操作均局限于该目录下;"
echo " -h 本帮助信息."
else
echo "Usage: sh ./${APPNAME} [Options]"
echo "Options:"
echo " -r <workdir> workdir is the working directory, all actions from this scripts under this folder;"
echo " -h This help."
fi
exit $1
}
# Check the input
# 检测输入的选项
while getopts 'r:h:?' arg; do
case "${arg}" in
r) workdir="${OPTARG}" ;;
h|?) usage 0 ;;
*) if [ "${lang%_*}x" = "zhx" ]; then
echo "错误: 无效参数 '${arg}'"
else
echo "Wrong option '${arg}'"
fi
usage 1 ;;
esac
done
if [ "x${workdir}" = "x" ]; then
if [ "${lang%_*}x" = "zhx" ]; then
echo "没有指定工作目录? 使用默认工作目录"/$(date +%m%d)" "
else
echo "No workdir pointed out? Use the default "/$(date +%m%d)" "
fi
workdir="/$(date +%m%d)"
fi
shift `expr $OPTIND - 1`
if [ "x$@" != "x" ]; then
if [ "${lang%_*}x" = "zhx" ]; then
echo "错误:无法识别的参数或命令: $@"
else
echo "Wrong: Unexpected options or command:$@"
fi
usage 1
fi
# Confirm to continue
# 确认后继续
if [ "${lang%_*}x" = "zhx" ]; then
echo -n -e "本脚本可能需要sudo来安装Mercurial(如果还没有安装), 会产生目录${workdir}, \
\n所有操作将局限于该目录中,请确保硬盘 / 分区有足够空间——如果包含X,需要3G左右空间. \
\n输入"y"继续: "
else
echo -n -e "This scripts will use sudo install Mercurial(If haven't installed), and will create folder ${workdir}, \
\nAll actions will be operated within this folder. Ensue your / partion have enough free space. \
\n——Need about 3GB if you build Archlive with X. \n \
\nInput "y" to continue: "
fi
read confirm
case $confirm in
Y|y) ;;
*) if [ "${lang%_*}x" = "zhx" ]; then
echo "输入无效,退出脚本..."
exit 1
else
echo "No "Y" or "y" inputed, exit the scripts..."
exit 1
fi
;;
esac
# Checking the hg tools
# 检查获取mkarchlive脚本的工具是否存在
hgrevision=$(hg -v 2>/dev/null | head -1 | awk '{print $5}')
hgrevision=${hgrevision%)}
# Install Mercurial if not installed
# 如果没有hg功能,则安装Mercurial
if [ "x${hgrevision}" = "x" ]; then
if [ "${lang%_*}x" = "zhx" ]; then echo "系统还没有装Mercurial."; else echo "No mercurial installed."; fi
if [ -f /etc/pacman.conf ]; then
if [ "${lang%_*}x" = "zhx" ]; then
echo "现在安装mercurial - 一个版本管理程序..."
else
echo "Start to install Mercurial-- A scalable distributed SCM tool ..."
fi
sudo pacman -S --noconfirm mercurial >/dev/null
if [ $? -eq 0 ]; then
if [ "${lang%_*}x" = "zhx" ]; then echo "Mercurial 安装完成!"; else echo "Mercurial installing finished!"; fi
else
if [ "${lang%_*}x" = "zhx" ]; then
echo "安装Mercurial失败,请自行手动安装..."
else
echo "Install Mercurial failed, try again after you installed Mercurial."
fi
fi
else
if [ "${lang%_*}x" = "zhx" ]; then
echo "宿主系统不是Arch,请先安装mercurial再执行本脚本..."
else
echo "Host system is not Arch GNU/Linux, try again after you installed Mercurial -- A scalable distributed SCM tool."
fi
exit 1
fi
fi
hgrevision=$(hg -v 2>/dev/null | head -1 | awk '{print $5}')
hgrevision=${hgrevision%)}
echo "Mercurial版本为 ${hgrevision}..."
# Create working directory (mkarchlive scripts and archlive working tmp all store in this foder.)
# 创建工作目录 (制作脚本及制作工作目录均存于此目录下.)
if [ -d ${workdir} ]; then
if [ "${lang%_*}x" = "zhx" ]; then
echo "工作目录${workdir}已经存在,是否删除?不删除则继续在改目录下制作archlive..."
else
echo "Working directory ${workdir} already exist, delete? You can rebuild Archlive without delete this folder..."
fi
sudo rm -ri ${workdir}
fi
sudo install -dm777 ${workdir}
sudo chown -R 1001:100 ${workdir}
# Check out the scripts
# 检出制作代码
cd ${workdir}
hg clone http://mkarchlive.archlive.googlecode.com/hg mkarchlive
# Start to build
# 开始自动创建
cd mkarchlive
log=${workdir}/$(whoami)-$(date +'%F-%H%M%S').log
sudo sh ./mkarchlive -f all ${workdir} 2>&1 | tee ${log}
# Clean the working directories
# 清理系统
cd ../
sudo umount -l ${workdir}/union 2>&1 >/dev/null
if [ "${lang%_*}x" = "zhx" ]; then
echo "现在工作缓存目录...也可以不删除缩减下次制作时间..."
else
echo "Now, clean the $workdir, you also keep these directories to save time when you create Archlive next time."
fi
sudo rm -ri ${workdir}/{img_*,*_modules,sync,union} 2>&1 >/dev/null
tar -czvpf mkarchlive_build_log.tgz log ${log} list 2>&1 >/dev/null
if [ "${lang%_*}x" = "zhx" ]; then
echo "如果制作过程中有什么其他问题,将mkarchlive_build_log.tgz发邮件到 carbonjiao alt gmail dot com,感谢支持!"
else
echo "If you have some problems, you can send the log file "mkarchlive_build_log.tgz" to carbonjiao alt gmail dot com, thanks for your support!"
fi
作者: carbonjiao 发布时间: 2009-09-07
水平有限 只能纯支持了
作者: 马甲321 发布时间: 2009-09-07
|
作者: 马甲321
up up
水平有限 只能纯支持了 |
忙啥呢
作者: carbonjiao 发布时间: 2009-09-07
作者: 独钓寒江雪 发布时间: 2009-09-07
|
作者: carbonjiao
好久没有见你提供PKGBUILD到googlecode或者aur上了!
忙啥呢 |
追新 x264.git mplayer-mt.git ffmpeg-mt.git ...
作者: 马甲321 发布时间: 2009-09-07
configure: error: /sdk/include/xpcom-config.h doesn't exist *** Fix above errors and then restart with "make -f client.mk build" make[1]: *** [configure] 错误 1 make[1]: Leaving directory `/tmp/yaourt-tmp-asins/aur-instantbird/instantbird/src/instantbird-0.1.3.1-src' make: *** [/tmp/yaourt-tmp-asins/aur-instantbird/instantbird/src/instantbird-0.1.3.1-src/../obj-instantbird/Makefile] 错误 2 ==> 错误: 创建失败。 正在放弃... Error: Makepkg was unable to build instantbird package.
作者: lwkyy 发布时间: 2009-09-08
作者: lxjlxjlxj 发布时间: 2009-09-08
|
作者: 马甲321
呵呵~在 oss 和 alsa 中徘徊了几次
追新 x264.git mplayer-mt.git ffmpeg-mt.git ... |
我已经编译了 20090906的git内核到googlecode。。。
作者: carbonjiao 发布时间: 2009-09-08
作者: axlrose 发布时间: 2009-09-08
作者: xblx 发布时间: 2009-09-08
可以是iso 可以 是 img (LiveUSB)
作者: carbonjiao 发布时间: 2009-09-08
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28















