76
76
mkdir -p ${DIRECTORY}/${STATIC_CHROOT_NAME}/run/shm
77
77
mount -o bind /run/shm ${DIRECTORY}/${STATIC_CHROOT_NAME}/run/shm
78
78
pushd "${DIRECTORY}/${STATIC_CHROOT_NAME}/etc" 1>&2>/dev/null
79
mv passwd passwd- 2&>1 >/dev/null
79
mv passwd passwd- 2&>1>/dev/null
81
mv shadow shadow- 2&>1 >/dev/null
81
mv shadow shadow- 2&>1>/dev/null
83
mv group group- 2&>1 >/dev/null
83
mv group group- 2&>1>/dev/null
85
mv gshadow gshadow- 2&>1 >/dev/null
85
mv gshadow gshadow- 2&>1>/dev/null
87
mv services services- 2&>1 >/dev/null
87
mv services services- 2&>1>/dev/null
88
88
cp /etc/services ./
89
mv protocols protocols- 2&>1 >/dev/null
89
mv protocols protocols- 2&>1>/dev/null
90
90
cp /etc/protocols ./
91
mv networks networks- 2&>1 >/dev/null
91
mv networks networks- 2&>1>/dev/null
92
92
cp /etc/networks ./
93
mv hosts hosts- 2&>1 >/dev/null
93
mv hosts hosts- 2&>1>/dev/null
95
mv resolv.conf resolv.conf- 2&>1 >/dev/null
95
mv resolv.conf resolv.conf- 2&>1>/dev/null
96
96
cp /etc/resolv.conf ./
97
mv etc/apt/apt.conf etc/apt/apt.conf- 2&>1 >/dev/null
97
mv etc/apt/apt.conf etc/apt/apt.conf- 2&>1>/dev/null
98
98
if [[ ! -z $HTTP_PROXY_HOST ]]; then
99
99
echo $HTTP_PROXY_HOST:$HTTP_PROXY_PORT
100
100
sudo tee -a /etc/apt/apt.conf <<EOF
101
101
Acquire::http::proxy "http://$HTTP_PROXY_HOST:$HTTP_PROXY_PORT/";
107
107
# Umount the mount points of the chroot and restore the default syste files
109
109
echo_log "Decouple the ${STATIC_CHROOT_NAME} chroot from the host system"
110
110
for MOUNT_POINT in $(mount|egrep ${STATIC_CHROOT_NAME}|awk '{print $3}')
112
umount -fl $MOUNT_POINT 2> /dev/null
112
umount -fl $MOUNT_POINT 2>/dev/null
114
pushd "${DIRECTORY}/${STATIC_CHROOT_NAME}/etc" 2>/dev/null
115
mv passwd- passwd 2>/dev/null
116
mv shadow- shadow 2>/dev/null
117
mv group- group 2>/dev/null
118
mv gshadow- gshadow 2>/dev/null
119
mv services- services 2>/dev/null
120
mv protocols- protocols 2>/dev/null
121
mv networks- networks 2>/dev/null
122
mv hosts- hosts 2>/dev/null
123
mv resolv.conf- resolv.conf 2>/dev/null
124
mv /etc/apt/apt.conf- /etc/apt/apt.conf 2>/dev/null
114
pushd "${DIRECTORY}/${STATIC_CHROOT_NAME}/etc" 1>&2>/dev/null
115
mv passwd- passwd 1>&2>/dev/null
116
mv shadow- shadow 1>&2>/dev/null
117
mv group- group 1>&2>/dev/null
118
mv gshadow- gshadow 1>&2>/dev/null
119
mv services- services 1>&2>/dev/null
120
mv protocols- protocols 1>&2>/dev/null
121
mv networks- networks 1>&2>/dev/null
122
mv hosts- hosts 1>&2>/dev/null
123
mv resolv.conf- resolv.conf 1>&2>/dev/null
124
mv /etc/apt/apt.conf- /etc/apt/apt.conf 1>&2>/dev/null
128
128
# Install the SDK packages to the core chroot and enable development
214
214
mv ${SCHROOT_CHROOT_PATH}/${STATIC_CHROOT_NAME} ${SCHROOT_CHROOT_PATH}/backup-`date +"%Y%m%d%H%M%S"`-${STATIC_CHROOT_NAME}
215
215
rm /etc/schroot/chroot.d/${STATIC_CHROOT_NAME}
217
fatal_failure "Removing ${STATIC_CHROOT_NAME}"
217
echo_log "${SCHROOT_CHROOT_PATH}/${STATIC_CHROOT_NAME} does not exist"
283
283
STATIC_CHROOT_NAME="click-${FRAMEWORK}-${TARGET_ARCH}"
285
285
echo_log "\e[0m-- Settings -- "
286
echo_log " Create image:\t \e[31m${CREATE_STATIC_IMAGE}\e[0m"
287
286
echo_log " Framework:\t \e[31m${FRAMEWORK}\e[0m"
288
287
echo_log " Target arch:\t \e[31m${TARGET_ARCH}\e[0m"
289
288
echo_log " Local arch:\t \e[31m${ARCH_TYPE}\e[0m"
289
echo_log " Create image:\t \e[31m${CREATE_STATIC_IMAGE}\e[0m"
290
290
echo_log " Downloading:\t \e[31m${DOWNLOAD_IMAGE}\e[0m"
291
291
echo_log " Use image:\t \e[31m${USE_READY_IMAGE}\e[0m"
292
echo_log " Remove chroot:\t \e[31m${REMOVE_TARGET}\e[0m"
292
293
echo_log " Chroot name:\t \e[31m${STATIC_CHROOT_NAME}\e[0m"
293
294
echo_log " Chroot path:\t \e[31m${SCHROOT_CHROOT_PATH}\e[0m"
294
295
echo_log "------------- "
297
297
if [[ ${REMOVE_TARGET} == true ]]; then