-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchroot-dist
More file actions
executable file
·46 lines (40 loc) · 1.33 KB
/
Copy pathchroot-dist
File metadata and controls
executable file
·46 lines (40 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
#===============================================================================
#
# FILE: chroot-ubuntu.sh
#
# USAGE: ./chroot-ubuntu.sh
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: adaptee (), adaptee@gmail.com
# COMPANY: Open Source Corporation
# VERSION: 1.0
# CREATED: 2010年01月15日 19时00分05秒 CST
# REVISION: ---
#===============================================================================
# Example
# command => chroot-gentoo
# distro => gentoo
command=$(basename $0)
distro=${command#*-}
for item in {/boot,/dev,/dev/pts,/proc,/sys,/mnt/personal} ; do
if [ -d "/mnt/${distro}/${item}" ] ; then
sudo mount --bind "${item}" "/mnt/${distro}/${item}"
fi
done
#sudo chname "${distro}" chroot "/mnt/${distro}"
#sudo $HOME/bin/chname "${distro}" chroot "/mnt/${distro}"
#sudo $HOME/bin/chname "${distro}" chroot "/mnt/${distro}" zsh
#sudo $HOME/bin/chname "${distro}" chroot "/mnt/${distro}" "/bin/bash" -l
sudo $HOME/bin/chname "${distro}" chroot "/mnt/${distro}" su -l whodare
# do not forget the cleanup work
#for item in {/boot,/dev,/dev/pts,/proc,/sys,/mnt/personal} ; do
#if [ -d "/mnt/${distro}/${item}" ] ; then
#sudo umount -l "/mnt/${distro}/${item}"
#fi
#done