From 013b1be1df70603dd825e10903983aa8fe20afc0 Mon Sep 17 00:00:00 2001 From: yuk7 Date: Thu, 6 Feb 2020 23:03:10 +0900 Subject: [PATCH] Wrote Makefile for CentOS8 --- .travis.yml | 35 ++++---------------------------- Makefile | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++ env.sh | 28 -------------------------- 3 files changed, 61 insertions(+), 59 deletions(-) create mode 100644 Makefile delete mode 100644 env.sh diff --git a/.travis.yml b/.travis.yml index c9782e8..e5d4bc8 100755 --- a/.travis.yml +++ b/.travis.yml @@ -3,41 +3,14 @@ language: bash addons: apt: packages: - - aria2 + - curl - zip - unzip before_script: - sudo apt-get update -qq -- sudo apt-get install aria2 zip unzip check -qq +- sudo apt-get install curl zip unzip check -qq script: -- source ./env.sh -- "${DLR} ${ROOTFS_URL} -o ${ROOTFS_TGZ}" -- "${DLR} ${LNCR_URL} -o ${LNCR_ZIP}" -- -- unzip ${LNCR_ZIP} ${LNCR_FN} -- sudo tar -zxpf ${ROOTFS_TGZ} -- -- sudo losetup --partscan /dev/loop0 ${ROOTFS_FN} -- sudo mkdir mntfs -- sudo mount -o ro /dev/loop0p1 mntfs -- sudo cp -a mntfs rootfs -- sudo umount mntfs -- -- echo "# This file was automatically generated by WSL. To stop automatic generation - of this file, remove this line." | sudo tee ./rootfs/etc/resolv.conf -- -- cd rootfs -- sudo tar -zcpf ../rootfs.tar.gz * -- sudo chown `id -un` ../rootfs.tar.gz -- cd .. -- -- mkdir out -- mkdir dist -- mv -f ${LNCR_FN} ./out/${LNCR_ZIPFN} -- mv -f rootfs.tar.gz ./out/ -- cd out -- zip ../dist/CentOS${OS_VER}.zip * -- cd .. +- make notifications: email: false deploy: @@ -45,7 +18,7 @@ deploy: api_key: secure: c3go1osy/T3T7qhZvQQnxR09ck5anmwGVQyQtrlx9B6QnQhLRF0NpV0CYt4PD6/4MUedCC0/EFmZpVogUyea/3F+F/j2fxsg4xUdm6gUNBKUH5wfdbHEW01JVfvwgtlZKFZmCrgNxS931yVM9yvPv02uPC4qjv2wP459wUbnEq5UkhOSaNd8rra1kaUnHdvqlJsBEKc7+lcElRuW5gFMknLXD2X3irXYr5+L2idVSmmApDwU9ufN5zAEUsh+4s3W7YZVxkrYuR2qZVHvA6jaFkKmdkO0giBaz9Tpz6UVErkWNtR6F3OWtjG3dj9dMOSIX4yjuugyDxhQsHZIbErg8TGYIIoW3tMydbgwmTOOCSKZoPSg07kByjiAQSlyVe9ISevUwyCU1TTcnQRF93/CMdDV7bnT8OAfFMkmTL/vqGNyijz5QhRVSswP8jfITx/L1jEXszEcB6hiTZu0y68tBy5ovW3o/V1Yhf03Ny941LG4AMkEuQytw5kALH8r/GKBy1HEbxSVvlaHb1ygwPh2AZoANXPGjvpBZ4gh3+95Tm0W2hMnPkbHtlXMQjfxVHabS96GB6l174aWxHD/u97bbL9AUUr2J2wx5LOoQf9Bf5mMRfPvHn8+JWgqLrO2D4LtOxNF2cGyip61uaMO36wyhbUyeFOMJEeGCNJv1wGVtK8= file_glob: true - file: 'dist/*.{zip}' + file: 'CentOS*.{zip}' on: repo: yuk7/CentWSL tags: true diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..80beb81 --- /dev/null +++ b/Makefile @@ -0,0 +1,57 @@ +OUT_ZIP=CentOS8.zip +LNCR_EXE=CentOS8.exe + +DLR=curl +DLR_FLAGS=-L +BASE_URL=http://cloud.centos.org/centos/8/x86_64/images/CentOS-8-Container-8.1.1911-20200113.3-layer.x86_64.tar.xz +LNCR_ZIP_URL=https://github.com/yuk7/wsldl/releases/download/20013100/icons.zip +LNCR_ZIP_EXE=CentOS.exe + +all: $(OUT_ZIP) + +zip: $(OUT_ZIP) +$(OUT_ZIP): ziproot + @echo -e '\e[1;31mBuilding $(OUT_ZIP)\e[m' + cd ziproot; zip ../$(OUT_ZIP) * + +ziproot: Launcher.exe rootfs.tar.gz + @echo -e '\e[1;31mBuilding ziproot...\e[m' + mkdir ziproot + cp Launcher.exe ziproot/${LNCR_EXE} + cp rootfs.tar.gz ziproot/ + +exe: Launcher.exe +Launcher.exe: icons.zip + @echo -e '\e[1;31mExtracting Launcher.exe...\e[m' + unzip icons.zip $(LNCR_ZIP_EXE) + mv $(LNCR_ZIP_EXE) Launcher.exe + +icons.zip: + @echo -e '\e[1;31mDownloading icons.zip...\e[m' + $(DLR) $(DLR_FLAGS) $(LNCR_ZIP_URL) -o icons.zip + +rootfs.tar.gz: rootfs + @echo -e '\e[1;31mBuilding rootfs.tar.gz...\e[m' + cd rootfs; sudo tar -zcpf ../rootfs.tar.gz `sudo ls` + sudo chown `id -un` rootfs.tar.gz + +rootfs: base.tar.xz + @echo -e '\e[1;31mBuilding rootfs...\e[m' + mkdir rootfs + sudo tar -xpf base.tar.xz -C rootfs + echo "# This file was automatically generated by WSL. To stop automatic generation of this file, remove this line." | sudo tee rootfs/etc/resolv.conf + sudo chmod +x rootfs + +base.tar.xz: + @echo -e '\e[1;31mDownloading base.tar.xz...\e[m' + $(DLR) $(DLR_FLAGS) $(BASE_URL) -o base.tar.xz + +clean: + @echo -e '\e[1;31mCleaning files...\e[m' + -rm ${OUT_ZIP} + -rm -r ziproot + -rm Launcher.exe + -rm icons.zip + -rm rootfs.tar.gz + -sudo rm -r rootfs + -rm base.tar.gz diff --git a/env.sh b/env.sh deleted file mode 100644 index 3f2eed8..0000000 --- a/env.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -ARCH="x86_64" -OS_VER="7" -ROOTFS_VER="1907" -ROOTFS_FN="CentOS-${OS_VER}-${ARCH}-GenericCloud-${ROOTFS_VER}.raw" -ROOTFS_TGZ="${ROOTFS_FN}.tar.gz" -ROOTFS_URL="http://cloud.centos.org/centos/${OS_VER}/images/${ROOTFS_TGZ}" - -LNCR_BLD="20013100" -LNCR_ZIP="icons.zip" -LNCR_NAME="CentOS" -LNCR_FN=${LNCR_NAME}.exe -LNCR_ZIPFN=${LNCR_NAME}${OS_VER}.exe -LNCR_URL="https://github.com/yuk7/wsldl/releases/download/${LNCR_BLD}/${LNCR_ZIP}" - - -if type curl >/dev/null 2>&1 ;then - DLR="curl" -fi -if type wget >/dev/null 2>&1;then - DLR="wget" -fi -if type aria2c >/dev/null 2>&1; then - DLR="aria2c -x4" -fi - -