diff options
| author | Mistivia <i@mistivia.com> | 2025-10-23 23:44:03 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-10-23 23:44:07 +0800 |
| commit | c8aeef18cb46a617b6397b9822263895e97e9048 (patch) | |
| tree | ebe127e7c194039f315b74a5998b05a271c57b9d /ngircd/scripts | |
add ircd
Diffstat (limited to 'ngircd/scripts')
| -rw-r--r-- | ngircd/scripts/build-docker.sh | 8 | ||||
| -rwxr-xr-x | ngircd/scripts/create_rootfs.sh | 40 |
2 files changed, 48 insertions, 0 deletions
diff --git a/ngircd/scripts/build-docker.sh b/ngircd/scripts/build-docker.sh new file mode 100644 index 0000000..e7e0d15 --- /dev/null +++ b/ngircd/scripts/build-docker.sh @@ -0,0 +1,8 @@ +sudo rm -rf rootfs +mkdir rootfs +sh ./scripts/create_rootfs.sh ngircd rootfs/ +cp ngircd rootfs/ +cp config.ini rootfs/ +sudo docker build -t localhost/ngircd . +sudo docker save localhost/ngircd | gzip > ngircd-docker-image.tar.gz +sudo docker rmi localhost/ngircd diff --git a/ngircd/scripts/create_rootfs.sh b/ngircd/scripts/create_rootfs.sh new file mode 100755 index 0000000..4cf1740 --- /dev/null +++ b/ngircd/scripts/create_rootfs.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +copy_with_path() { + if [ "$#" -ne 2 ]; then + echo "Usage: copy_with_path_creation <source_file> <destination_base_path>" + return 1 + fi + + local source_file="$1" + local destination_base_path="$2" + + local source_dir=$(dirname "$source_file") + + local destination_dir="${destination_base_path}${source_dir}" + + if mkdir -p "$destination_dir"; then + echo "Created directory: $destination_dir" + if cp "$source_file" "$destination_dir/"; then + echo "Copied file: $source_file to $destination_dir/" + return 0 + else + echo "Error: Failed to copy file $source_file to $destination_dir/" + return 1 + fi + else + echo "Error: Failed to create directory $destination_dir" + return 1 + fi +} + +if [ "$#" -ne 2 ]; then + echo "Usage: copyldd <target_exec> <dest_dir>" + exit 1 +fi + +for f in $(ldd $1 | grep "=>" | awk '{print $3}') ; do + copy_with_path $f $2 +done + +cp -r $2/usr/lib64 $2/ |
