diff --git a/README.md b/README.md index 0989daf..f4b3201 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,58 @@ ## ai `os` + + - name : ai os +- base : [archlinux](https://gitlab.archlinux.org/archlinux) -- base : [archlinux](https://gitlab.archlinux.org/archlinux/archlinux-docker) +### docker +```sh +$ docker run --rm syui/aios ai ai -t os +``` +### archiso + +- [profile.rst](https://gitlab.archlinux.org/archlinux/archiso/-/blob/master/docs/README.profile.rst) + +```sh +$ pacman -S archiso +``` + +```sh +$ git clone https://git.syui.ai/ai/os +$ cd os +$ git clone https://gitlab.archlinux.org/archlinux/archlinux-docker +$ git clone https://gitlab.archlinux.org/archlinux/archiso + +$ cp ./profiledef.sh ./archiso/configs/releng/profiledef.sh + +$ mkarchiso -v -o ./ ./archiso/configs/releng +``` + +### system + +> ./archiso/configs/releng/profiledef.sh + +```sh +buildmodes=('bootstrap') +``` + +```sh +$ mkarchiso -v -o ./ ./archiso/configs/releng +$ tar xf aios-bootstrap*.tar.gz +$ echo -e 'Server = http://mirrors.cat.net/archlinux/$repo/os/$arch\nServer = https://geo.mirror.pkgbuild.com/$repo/os/$arch' >> ./root.x86_64/etc/pacman.d/mirrorlist +$ sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/etc/pacman.conf +$ arch-chroot ./root.86_64 +--- +$ pacman -S base base-devel linux vim git zsh rust +$ pacman-key --init +$ pacman-key --populate archlinux +$ exit +--- +$ tar -C root.86_64 -c . | docker import - syui/aios +$ docker images + +$ docker run --rm syui/aios cargo version +cargo 1.75.0 +``` diff --git a/archiso b/archiso new file mode 160000 index 0000000..1f65b69 --- /dev/null +++ b/archiso @@ -0,0 +1 @@ +Subproject commit 1f65b695d309d6089bdc2251bb4c9aa00bd11a51 diff --git a/archlinux-docker b/archlinux-docker new file mode 160000 index 0000000..98cd791 --- /dev/null +++ b/archlinux-docker @@ -0,0 +1 @@ +Subproject commit 98cd79111dd530447f491d547d14f3c38e227e46 diff --git a/build.zsh b/build.zsh new file mode 100755 index 0000000..3421cb8 --- /dev/null +++ b/build.zsh @@ -0,0 +1,45 @@ +#!/bin/zsh + +d=${0:a:h} +case $1 in + bsae) + a=baseline + ;; + *) + a=releng + ;; +esac + +if [ ! -d $d/archiso ];then + git clone https://gitlab.archlinux.org/archlinux/archiso +fi + +if [ ! -f $d/archlinux-docker ];then + git clone https://gitlab.archlinux.org/archlinux/archlinux-docker +fi + +cp -rf $d/cfg/profiledef.sh $d/archiso/configs/$a/profiledef.sh +cp -rf $d/scpt/mkarchiso $d/archiso/archiso/mkarchiso + +$d/archiso/archiso/mkarchiso -v -o $d/ $d/archiso/configs/releng + +if [ ! -d $d/root.x86_64 ];then + tar xf $d/aios-bootstrap*.tar.gz +fi + +echo -e 'Server = http://mirrors.cat.net/archlinux/$repo/os/$arch\nServer = https://geo.mirror.pkgbuild.com/$repo/os/$arch' >> ./root.x86_64/etc/pacman.d/mirrorlist +sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/etc/pacman.conf +arch-chroot root.x86_64 /bin/sh -c 'pacman-key --init' +arch-chroot root.x86_64 /bin/sh -c 'pacman-key --populate archlinux' +arch-chroot root.x86_64 /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl' +arch-chroot root.x86_64 /bin/sh -c 'git clone https://git.syui.ai/ai/bot && cd bot && cargo build && cp -rf ./target/debug/ai /bin/ && ai ai -t os' + +# docker image +systemctl start docker +tar -C $d/root.x86_64 -c . | docker import - syui/aios + +docker images -a +docker run --rm syui/aios ai ai -t os + +# docker run -it syui/aios zsh +# docker push syui/aios diff --git a/cfg/hostname b/cfg/hostname new file mode 100644 index 0000000..5f98dbb --- /dev/null +++ b/cfg/hostname @@ -0,0 +1 @@ +aios diff --git a/cfg/os-release b/cfg/os-release new file mode 100644 index 0000000..e0dc19c --- /dev/null +++ b/cfg/os-release @@ -0,0 +1,13 @@ +NAME="ai os" +PRETTY_NAME="ai os" +ID=ai +BUILD_ID=rolling +ANSI_COLOR="38;2;23;147;209" +HOME_URL="https://git.syui.ai/ai/os" +DOCUMENTATION_URL="https://git.syui.ai/ai/os/wiki" +SUPPORT_URL="https://git.syui.ai/ai/os/issues" +BUG_REPORT_URL="https://git.syui.ai/ai/os/issues" +PRIVACY_POLICY_URL="https://git.syui.ai/ai/os" +LOGO=ai-logo +IMAGE_ID=aios +IMAGE_VERSION=2024.02.09 diff --git a/cfg/profiledef.sh b/cfg/profiledef.sh new file mode 100644 index 0000000..146fddb --- /dev/null +++ b/cfg/profiledef.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# shellcheck disable=SC2034 + +iso_name="aios" +iso_label="AI_$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y%m)" +iso_publisher="ai os " +iso_application="ai os Live/Rescue DVD" +iso_version="$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y.%m.%d)" +install_dir="ai" +#buildmodes=('iso') +buildmodes=('bootstrap') +bootmodes=('bios.syslinux.mbr' 'bios.syslinux.eltorito' + 'uefi-ia32.grub.esp' 'uefi-x64.grub.esp' + 'uefi-ia32.grub.eltorito' 'uefi-x64.grub.eltorito') +arch="x86_64" +pacman_conf="pacman.conf" +airootfs_image_type="squashfs" +airootfs_image_tool_options=('-comp' 'xz' '-Xbcj' 'x86' '-b' '1M' '-Xdict-size' '1M') +file_permissions=( + ["/etc/shadow"]="0:0:400" + ["/root"]="0:0:750" + ["/root/.automated_script.sh"]="0:0:755" + ["/root/.gnupg"]="0:0:700" + ["/usr/local/bin/choose-mirror"]="0:0:755" + ["/usr/local/bin/Installation_guide"]="0:0:755" + ["/usr/local/bin/livecd-sound"]="0:0:755" +) diff --git a/icon/ai.png b/icon/ai.png new file mode 100644 index 0000000..d21dabe Binary files /dev/null and b/icon/ai.png differ diff --git a/icon/avatar.png b/icon/avatar.png new file mode 100644 index 0000000..f091ef1 Binary files /dev/null and b/icon/avatar.png differ diff --git a/icon/wall.png b/icon/wall.png new file mode 100644 index 0000000..8717aa8 Binary files /dev/null and b/icon/wall.png differ diff --git a/scpt/mkarchiso b/scpt/mkarchiso new file mode 100755 index 0000000..3613a15 --- /dev/null +++ b/scpt/mkarchiso @@ -0,0 +1,2058 @@ +#!/usr/bin/env bash +# +# SPDX-License-Identifier: GPL-3.0-or-later + +set -e -u +shopt -s extglob + +# Control the environment +umask 0022 +export LC_ALL="C.UTF-8" +if [[ -v LANGUAGE ]]; then + # LC_ALL=C.UTF-8, unlike LC_ALL=C, does not override LANGUAGE. + # See https://sourceware.org/bugzilla/show_bug.cgi?id=16621 and https://savannah.gnu.org/bugs/?62815 + unset LANGUAGE +fi +[[ -v SOURCE_DATE_EPOCH ]] || printf -v SOURCE_DATE_EPOCH '%(%s)T' -1 +export SOURCE_DATE_EPOCH + +# Set application name from the script's file name +app_name="${0##*/}" + +# Define global variables. All of them will be overwritten later +pkg_list=() +bootstrap_pkg_list=() +quiet="" +work_dir="" +out_dir="" +gpg_key="" +gpg_sender="" +iso_name="" +iso_label="" +iso_uuid="" +iso_publisher="" +iso_application="" +iso_version="" +install_dir="" +arch="" +pacman_conf="" +packages="" +bootstrap_packages="" +pacstrap_dir="" +declare -i rm_work_dir=0 +buildmodes=() +bootmodes=() +airootfs_image_type="" +airootfs_image_tool_options=() +cert_list=() +declare -A file_permissions=() +efibootimg="" +efiboot_files=() +# adapted from GRUB_EARLY_INITRD_LINUX_STOCK in https://git.savannah.gnu.org/cgit/grub.git/tree/util/grub-mkconfig.in +readonly ucodes=('intel-uc.img' 'intel-ucode.img' 'amd-uc.img' 'amd-ucode.img' 'early_ucode.cpio' 'microcode.cpio') + + +# Show an INFO message +# $1: message string +_msg_info() { + local _msg="${1}" + [[ "${quiet}" == "y" ]] || printf '[%s] INFO: %s\n' "${app_name}" "${_msg}" +} + +# Show a WARNING message +# $1: message string +_msg_warning() { + local _msg="${1}" + printf '[%s] WARNING: %s\n' "${app_name}" "${_msg}" >&2 +} + +# Show an ERROR message then exit with status +# $1: message string +# $2: exit code number (with 0 does not exit) +_msg_error() { + local _msg="${1}" + local _error=${2} + printf '[%s] ERROR: %s\n' "${app_name}" "${_msg}" >&2 + if (( _error > 0 )); then + exit "${_error}" + fi +} + +# Show help usage, with an exit status. +# $1: exit status number. +_usage() { + IFS='' read -r -d '' usagetext < + options: + -A Set an application name for the ISO + Default: '${iso_application}' + -C pacman configuration file. + Default: '${pacman_conf}' + -D Set an install_dir. All files will be located here. + Default: '${install_dir}' + NOTE: Max 8 characters, use only [a-z0-9] + -L