LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1276|回复: 7

关于archlinux 安装的问题

[复制链接]
发表于 2005-10-28 16:04:01 | 显示全部楼层 |阅读模式
我现在使用的系统是gentoo+windows xp双系统
安装了grub了
我象在以前作备份的一个盘里面安装一下arch linux
arch能不能这样安装,设置好他的挂载点,然后安装包
不安装内核,直接退出安装,然后去去gentoo下面把他作好grub
用我gentoo一样的内核,因为我使用的是reiser4的文件格式,arch默认的内核不支持
谢谢
发表于 2005-10-28 16:31:08 | 显示全部楼层
直接安装arch,再安装kernel26mm 或者community下的kernel26archck就支持reiser4,这样不好么。
不要把简单问题变复杂化嘛
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-10-28 16:59:45 | 显示全部楼层
关键我不想对以前的gentoo造成伤害了
不过也无所谓了
能不能告诉我可以或不可以
回复 支持 反对

使用道具 举报

发表于 2005-10-28 22:33:36 | 显示全部楼层
没试过这样安装,不过你可以试下下面的脚本。在gentoo下通过网络安装archlinux到任意一个分区。
archbootscript /mnt/hda_newsys http://debian.okey.net/archlinux
[PHP]#!/bin/bash
#########################################################################
# archbootstrap                                                         #
#                                                                       #
# archbootstrap is to archlinux what debootstrap is to Debian.          #
#                                                                       #
#                                                                       #
# archbootstrap is public domain though i wouldn't mind getting credit. #
#                                                                       #
# by David Leinh鋟ser (archlinux@calavera.de)                           #
# Tarbuild mode and misc cleanups by butters (jsaretsk@andrew.cmu.edu)  #
# (minor tweak by dma174)                                               #
#########################################################################

########################
# Tarbuild Mode Switch #
########################
TARMODE=0
KBUILD=0
WCACHE=0
UBUILD=0

if [ "$1" == "-tb" ]; then
    INTERACTIVE=0
    TARMODE=1
    NUMPARAMS=0
    shift
    if [ "$1" == "--keep-build" ] ||
       [ "$2" == "--keep-build" ] ||
       [ "$3" == "--keep-build" ]; then
       KBUILD=1
       NUMPARAMS=$(( ${NUMPARAMS} + 1 ))
    fi
    if [ "$1" == "--with-cache" ] ||
       [ "$2" == "--with-cache" ] ||
       [ "$3" == "--with-cache" ]; then
       WCACHE=1
       NUMPARAMS=$(( ${NUMPARAMS} + 1 ))
    fi
    if [ "$1" == "--use-build" ] ||
       [ "$2" == "--use-build" ] ||
       [ "$3" == "--use-build" ]; then
       UBUILD=1
       NUMPARAMS=$(( ${NUMPARAMS} + 1 ))
    fi
    shift ${NUMPARAMS}
fi

####################
# Default Settings #
####################
MYVERSION="0.4"                              # Version number of this script.
GETCMD="${GETCMD:-wget --passive-ftp -c -q}" # What we use to download files.
PREINSTALL="${PREINSTALL:-glibc iputils}"    # Packages to install before using
                                              # pacman to fetch the rest.
IGNORE="${IGNORE:-}"                         # Packages not to be installed.
TARGET="${1:---help}"                        # Where to bootstrap to
SERVER="${2:-ftp://ftp.archlinux.org}"       # Where to fetch all the files.
INTERACTIVE="${INTERACTIVE:-1}"              # Interactive mode or batch mode

REPOS="current"                              # Which repository to use.
EXTRADIR="os/i686"
PKG_PACMAN="setup/pacman.pkg.tar.gz"         # Where to find pacman.
PKGLIST="setup/packages.txt"                 # Where to find the packages list.
PKG_PREFIX="base"                            # Install pkgs with this prefix.

####################
# Helper Functions #
####################
PREV_DIR="$(pwd)" # remember current directory so we can chdir back later.

# Print an error message to stderr and quit.
function error() {
    echo "Error: $*" >&2
    cd "${PREV_DIR}"
    exit 1;
}

# Simply exit the script.
function quit() {
    cd "${PREV_DIR}"
    exit 0;
}

# Wrapper around cd for lazy people like me.
function chngdir() {
    cd "$@" || error "chdir failed."
}

#Wrapper around mkdir for lazy people like me.
function makedir() {
    mkdir -p "$@" || error "mkdir failed."
}

#Fetch given URLs into current dir.
function fetch() {
    while [ -n "${1}" ]; do
       if [ -z "${1##file://*}" ]; then
          F="${1#file://}"
          echo "Copying ${F}."
          cp "${1#file://}" . || error "Error copying ${F}."
       else
          echo "Fetching ${1}."
          ${GETCMD} "${1}" || error "Error fetching ${1}."
       fi
       shift
    done
}

#Read the package list
PACKAGES=()
function read_pkglist() {
    while read -s; do
       PACKAGES=("${PACKAGES[@]}" "${REPLY}")
    done <"${BOOTSTRAP}/${PKGLIST##*/}"
}

#Return 1 if the first argument does not equal any of the other arguments.
function match() {
    PATTERN="${1}"
    shift
    while [ -n "${1}" ]; do
       [ "${PATTERN}" == "${1}" ] && return 0
       shift
    done
    return 1
}

######################
# Sanity checks etc. #
######################
case "${TARGET}" in
    --help|-h)
       echo "Usage: archbootstrap <dir> [server]"
       echo "Usage: archbootstrap -tb [--keep-build] [--use-build] [--with-cache] <dir> [server]"
       quit;
       ;;
    --version)
       echo "archbootstrap ${MYVERSION}";
       quit;
       ;;
esac

[ "$UID" == "0" ] || error "You need to be root."

echo "archbootstrap $MYVERSION"

# This is an easy way to get an useful absolute path.
chngdir "${TARGET}"
TARGET="$(pwd)"

# Create working directory.
TEMP="${TARGET}/tmp"
makedir -m 1777 -p "${TEMP}"
BOOTSTRAP="${TEMP}/bootstrap"
PKG_CACHE="${TARGET}/var/cache/pacman/pkg"
makedir -m 0755 -p "${BOOTSTRAP}"
makedir -m 0755 -p "${PKG_CACHE}"
if [ -d "${TARGET}/pkg" ]; then
    echo "Using existing pkg cache..."
    mv -f ${TARGET}/pkg/* "${PKG_CACHE}"
elif [ -n "$(ls ${PKG_CACHE})" ]; then
    echo "Using existing pkg cache..."
else
    echo "No pkg cache found, fetching all pkg files..."
fi

chngdir "${BOOTSTRAP}"

########################################
# Stuff we need for our staged install #
########################################
function set_stage() {
    STAGE="${1}"
}

STAGE="start"
if [ "${TARMODE}" == "1" ] && [ "${UBUILD}" == "1" ]; then
    STAGE="cleanup"
fi

##################
# pacman wrapper #
##################
PACMAN=("$(which chroot)" "${TARGET}" "${BOOTSTRAP#${TARGET}}/usr/bin/pacman.static")
function add_pkgs() {
    PKGS=()
    while [ -n "${1}" ]; do
       PKGS=("${PKGS[@]}" "${1#${TARGET}}")
       shift
    done
    "${PACMAN[@]}" -A "${PKGS[@]}" || error "Could not add a package."
}

function sync_pkgs() {
    if [ "${INTERACTIVE}" == "1" ]; then
       "${PACMAN[@]}" -Syf "${@}" || error "Could not sync a package."
    else
       echo y | "${PACMAN[@]}" -Syf "${@}" || \
          error "Could not sync a package."
    fi
}

#############
# Main loop #
#############
PREV_STAGE=""
FURL="${SERVER}/${REPOS}/${EXTRADIR}"

until [ "${PREV_STAGE}" == "${STAGE}" ]; do
    PREV_STAGE="${STAGE}"
    case "${STAGE}" in
    start)
       chngdir "${BOOTSTRAP}"
       fetch "${FURL}/${PKG_PACMAN}" "${FURL}/${PKGLIST}"
       tar xfz ${PKG_PACMAN##*/} || \
       error "Could not untar ${BOOTSTRAP}${PKG_PACMAN##*/}."
       makedir "${TARGET}/etc"
       { echo "[${REPOS}]";
         echo "Server = ${FURL}"; } >"${TARGET}/etc/pacman.conf" || \
          error "Could not create ${TARGET}/etc/pacman.conf."
       cp -f "/etc/resolv.conf" "${TARGET}/etc/resolv.conf" || \
          error "Could not copy /etc/resolv.conf."
       set_stage "pre_packages"
       ;;
    pre_packages)
       chngdir "${PKG_CACHE}"
       [ "${#PACKAGES[@]}" == "0" ] && read_pkglist;
       for I in "${PACKAGES[@]}"; do
          PKGPREFIX="${I%%/*}"
          PKGFILE="${I##*/}"
          PKGNAME="${PKGFILE%-*-*.pkg.tar.gz}"
          if match "${PKGNAME}" ${PREINSTALL}; then
             fetch "${FURL}/${PKGFILE}"
             add_pkgs "${PKG_CACHE}/${PKGFILE}"
          fi
       done
       set_stage "packages"
       ;;
    packages)
       chngdir "${BOOTSTRAP}"
       PKGS=()
       [ "${#PACKAGES[@]}" == "0" ] && read_pkglist;
       for I in "${PACKAGES[@]}"; do
          PKGPREFIX="${I%%/*}"
          PKGFILE="${I##*/}"
          PKGNAME="${PKGFILE%-*-*.pkg.tar.gz}"
          [ "${PKGPREFIX}" == "${PKG_PREFIX}" ] || continue
          match "${PKGNAME}" ${IGNORE} ${PREINSTALL} && continue
          PKGS=("${PKGS[@]}" "${PKGNAME}")
       done
       sync_pkgs "${PKGS[@]}"
       set_stage "cleanup"
       ;;
    cleanup)
       echo "Cleaning up..."
       chngdir "${TARGET}"
       rm -Rf "${BOOTSTRAP}" || error "Could not remove ${BOOTSTRAP}."
       [ "${TARMODE}" == "0" ] && quit
       set_stage "tarbuild"
       ;;
    tarbuild)
       echo "Building tarball..."
       chngdir "${TARGET}"
       if [ "${KBUILD}" == "0" ]; then
          TAROPTS="--remove-files --exclude ./pkg*"
          if [ "${WCACHE}" == "0" ]; then
             makedir "${TARGET}/pkg"
             mv -f ${PKG_CACHE}/* "${TARGET}/pkg"
          fi
       elif [ "${WCACHE}" == "0" ]; then
          TAROPTS="--exclude ./var/cache/pacman/pkg/* --exclude ./pkg*"
       else
          TAROPTS="--exclude ./pkg*"
       fi
       TARFILE="arch-base-`date +%Y%m%d`.tar.bz2"
       tar --create --bzip2 --preserve-permissions ${TAROPTS} --file="${TARGET}/${TARFILE}" ./*
       if [ "${KBUILD}" == "0" ]; then
          for NODE in *; do
             [ -f "${NODE}" ] && continue
             [ "${NODE}" == "pkg" ] && continue
             rm -r "${NODE}"
          done
       fi
       quit
       ;;
    esac
done[/PHP]
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-10-29 08:18:16 | 显示全部楼层
谢谢union兄
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-10-29 08:45:47 | 显示全部楼层
zgentoo libertine # ./archbootscript.sh /mnt/arch http://debian.okey.net/archlinux
archbootstrap 0.4
No pkg cache found, fetching all pkg files...
./archbootscript.sh: line 271: syntax error: unexpected end of file

这个文件你贴全了吗
能不能以附件的形式发送到我的邮箱呀
prolibertine@gmail.com
谢谢
回复 支持 反对

使用道具 举报

发表于 2005-10-30 01:37:12 | 显示全部楼层
这也是在bbs.archlinux.org上面搜索到的,wiki上有相关文章,如果有什么问题可以去bbs.archlinux.org或者IRC问问,应该很快就能得到解答
邮件给你发了,这里也贴一个附件。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-10-31 09:15:25 | 显示全部楼层
谢谢,邮件已经收到
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表