Commit 5506a9bc authored by sixue.cheng's avatar sixue.cheng :speech_balloon:
Browse files

update

No related merge requests found
Showing with 127 additions and 26 deletions
+127 -26
......@@ -14,7 +14,7 @@ variables:
ROOTFS_EXT4: ${CI_PIPELINE_ID}_${tagname}_rootfs.ext4
jforurl: http://120.92.155.32:8082/artifactory/ci/OS/fedora
gitcode: ssh://git@120.92.155.32:10080/tops/ops/Linux.git
ROOTFS_SIZE: 2584M
ROOTFS_SIZE: 3000M
init-job:
stage: test
script:
......@@ -22,8 +22,8 @@ init-job:
- rm -rf $file_name
- mkdir $file_name
- cd $file_name
# - git clone -b $branch_name $gitcode sh
# - mv sh/* .
- git clone -b $branch_name $gitcode sh
- mv sh/* .
tags:
# - shell.buildtest
# - shell.ubuntu
......@@ -52,26 +52,26 @@ download-job:
- shell.citest
needs:
- init-job
# creat-roofs-job:
# stage: creat-roofs
# script:
# - cd $code_url
# - sudo docker run --rm --name $file_name -u buildman --privileged=true -v $code_url:/home/buildman baseubuntu:v1 /bin/bash -c "cd /home/buildman && ./build.sh ${ROOTFS_EXT4} $tagname $ROOTFS_SIZE"
# tags:
# # - shell.buildtest
# # - shell.ubuntu
# - shell.citest
# needs:
# - download-job
# upload-rootfs-job:
# stage: upload-rootfs
# script:
# - cd $code_url
# - zip mini_${tagname}.zip $ROOTFS_EXT4
# - curl -uadmin:AP5ohjc77AatopcVBsY5cupHJ3J -T mini_${tagname}.zip $jforurl/mini_${tagname}.zip
# tags:
# # - shell.buildtest
# # - shell.ubuntu
# - shell.citest
# needs:
# - creat-roofs-job
creat-roofs-job:
stage: creat-roofs
script:
- cd $code_url
- sudo docker run --rm --name $file_name -u buildman --privileged=true -v $code_url:/home/buildman baseubuntu:v1 /bin/bash -c "cd /home/buildman && ./build.sh ${ROOTFS_EXT4} $tagname $ROOTFS_SIZE"
tags:
# - shell.buildtest
# - shell.ubuntu
- shell.citest
needs:
- download-job
upload-rootfs-job:
stage: upload-rootfs
script:
- cd $code_url
- zip mini_${tagname}.zip $ROOTFS_EXT4
- curl -uadmin:AP5ohjc77AatopcVBsY5cupHJ3J -T mini_${tagname}.zip $jforurl/mini_${tagname}.zip
tags:
# - shell.buildtest
# - shell.ubuntu
- shell.citest
needs:
- creat-roofs-job
build.sh 0 → 100755
#!/bin/bash
sudo mkdir rootfs
ROOTFS_EXT4=$1
ROOTFS_SIZE=$3
echo $ROOTFS_EXT4
sudo tar -xf $2 -C rootfs
./mount.sh
./umount.sh
./gen_rootfs.sh $ROOTFS_EXT4 $ROOTFS_SIZE
\ No newline at end of file
import wget
import sys
import os
def getFile(url):
try:
filename = wget.download(url)
except ImportError:
import traceback
msg = traceback.format_exc()
if __name__ == '__main__':
downurl= sys.argv[1]
getFile(downurl)
#!/bin/bash
export PATH=tools/mke2fs/bin:$PATH
export LD_LIBRARY_PATH=tools/mke2fs/lib:$LD_LIBRARY_PATH
export MKE2FS_CONFIG=tools/mke2fs/etc/mke2fs.conf
ROOTFS_DIR=rootfs
ROOTFS_EXT4=$1
ROOTFS_SIZE=$2
sudo rm -f $ROOTFS_EXT4
sudo mke2fs -d $ROOTFS_DIR -r 1 -N 0 -m 0 -L "" -O ^64bit $ROOTFS_EXT4 $ROOTFS_SIZE
\ No newline at end of file
mount.sh 0 → 100755
#!/bin/bash
# apt-get install -y xfce4
echo "Mounting file system"
sudo mount -t proc /proc rootfs/proc
sudo mount -t sysfs /sys rootfs/sys
sudo mount -o bind /dev rootfs/dev
sudo mount -o bind /dev/pts rootfs/dev/pts
echo "Change root"
sudo cp /usr/bin/qemu-riscv64-static rootfs/usr/bin
sudo cp seting.sh rootfs/root
sudo update-binfmts --import /tmp/qemu-riscv64
sudo chroot rootfs
<< EOF
cd root
bash seting.sh
rm seting.sh
EOF
\ No newline at end of file
seting.sh 0 → 100755
#!/bin/bash
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
# dnf install -y python3.10
# yum upgrade -y
yum install dhcpcd ntp
systemctl enable sshd
systemctl enable dhcpcd
systemctl enable ntpd
# systemctl enable ssh
# systemctl enable dhcpcd
#设置字符集
cat /etc/locale.conf
LANG="en_US.UTF-8"
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime
echo "roma" > /etc/hostname
echo 127.0.0.1 roma localhost.localdomain localhost >> /etc/hosts
echo root:root-Xcalibyte | chpasswd
useradd -m -G users -s /bin/bash roma
echo roma:roma-Xcalibyte | chpasswd
sed -i '/## Allows people in group wheel to run all commands/a roma ALL=(ALL:ALL) ALL' /etc/sudoers
# num=`sed -n '/if \[ -f \/etc\/bash_completion \] \&& \! shopt -oq posix\; then/=' /root/.bashrc`
# echo $num
# if [ num>0 ]; then
# sed -i ''"$num"','"$[num+2]"'d' /root/.bashrc
# fi
rm /boot/* -rf
ln -sf /dev/null /etc/systemd/system/serial-getty@hvc0.service
yum clean all
rm -rf /usr/bin/qemu-riscv64-static
\ No newline at end of file
#!/bin/bash
echo "Umounting file system"
sudo umount rootfs/proc
sudo umount rootfs/sys
sudo umount rootfs/dev/pts
sudo umount rootfs/dev
sudo rm -rf rootfs/usr/bin/qemu-riscv64-static
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment