Skip to content

Commit

Permalink
Update CentOS Stream backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
exalab999 committed Dec 8, 2023
1 parent cb4049a commit cda45e7
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Rootfs/CentOS/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
This folder has the SAME CONTENT as CentOS_Stream folder, content was kept here for backward compatibility, so user that didn't update AnLinux app to the latest version can also install CentOS Stream if they are using 64bit device.

This folder will be removed in the next end year update.


These image are CentOS Stream image, which is download by podman from here: [stream9-minimal](https://quay.io/repository/centos/centos?tab=tags&tag=stream9)

Command to pull:

Only 2 arch is available: amd64, arm64

> podman pull --arch=arm64 quay.io/centos/centos:stream9-minimal
Command to save the file:

> podman save --format docker-archive -o stream9-arm64.tar centos:stream9-minimal
Binary file added Rootfs/CentOS/amd64/centos-rootfs-amd64.tar.xz
Binary file not shown.
Binary file added Rootfs/CentOS/arm64/centos-rootfs-arm64.tar.xz
Binary file not shown.
3 changes: 3 additions & 0 deletions Scripts/Installer/CentOS/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This folder has the SAME CONTENT as CentOS_Stream folder, content was kept here for backward compatibility, so user that didn't update AnLinux app to the latest version can also install CentOS Stream if they are using 64bit device.

This folder will be removed in the next end year update.
106 changes: 106 additions & 0 deletions Scripts/Installer/CentOS/centos_stream.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#!/data/data/com.termux/files/usr/bin/bash
folder=centos_stream-fs
if [ -d "$folder" ]; then
first=1
echo "skipping downloading"
fi
tarball="centos_stream-rootfs.tar.xz"
if [ "$first" != 1 ];then
if [ ! -f $tarball ]; then
echo "Download Rootfs, this may take a while base on your internet speed."
case `dpkg --print-architecture` in
aarch64)
archurl="arm64" ;;
arm)
archurl="armhf" ;;
amd64)
archurl="amd64" ;;
x86_64)
archurl="amd64" ;;
i*86)
archurl="i386" ;;
x86)
archurl="i386" ;;
*)
echo "unknown architecture"; exit 1 ;;
esac
wget "https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Rootfs/CentOS/${archurl}/centos_stream-rootfs-${archurl}.tar.xz" -O $tarball
fi
cur=`pwd`
mkdir -p "$folder"
cd "$folder"
echo "Decompressing Rootfs, please be patient."
proot --link2symlink tar -xJf ${cur}/${tarball} --exclude='dev'||:

echo "Setting up name server"
echo "127.0.0.1 localhost" > etc/hosts
echo "nameserver 8.8.8.8" > etc/resolv.conf
echo "nameserver 8.8.4.4" >> etc/resolv.conf
cd "$cur"
fi
mkdir -p centos-binds
mkdir -p centos-fs/tmp
bin=start-centos_stream.sh
echo "writing launch script"
cat > $bin <<- EOM
#!/bin/bash
cd \$(dirname \$0)
pulseaudio --start
## For rooted user: pulseaudio --start --system
## unset LD_PRELOAD in case termux-exec is installed
unset LD_PRELOAD
command="proot"
command+=" --link2symlink"
command+=" -0"
command+=" -r $folder"
if [ -n "\$(ls -A centos-binds)" ]; then
for f in centos-binds/* ;do
. \$f
done
fi
command+=" -b /dev"
command+=" -b /proc"
command+=" -b centos-fs/root:/dev/shm"
## uncomment the following line to have access to the home directory of termux
#command+=" -b /data/data/com.termux/files/home:/root"
## uncomment the following line to mount /sdcard directly to /
#command+=" -b /sdcard"
command+=" -w /root"
command+=" /usr/bin/env -i"
command+=" HOME=/root"
command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games"
command+=" TERM=\$TERM"
command+=" LANG=C.UTF-8"
command+=" /bin/bash --login"
com="\$@"
if [ -z "\$1" ];then
exec \$command
else
\$command -c "\$com"
fi
EOM

echo "Setting up pulseaudio so you can have music in distro."

pkg install pulseaudio -y

if grep -q "anonymous" ~/../usr/etc/pulse/default.pa;then
echo "module already present"
else
echo "load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" >> ~/../usr/etc/pulse/default.pa
fi

echo "exit-idle-time = -1" >> ~/../usr/etc/pulse/daemon.conf
echo "Modified pulseaudio timeout to infinite"
echo "autospawn = no" >> ~/../usr/etc/pulse/client.conf
echo "Disabled pulseaudio autospawn"
echo "export PULSE_SERVER=127.0.0.1" >> centos-fs/etc/profile
echo "Setting Pulseaudio server to 127.0.0.1"

echo "fixing shebang of $bin"
termux-fix-shebang $bin
echo "making $bin executable"
chmod +x $bin
echo "removing image for some space"
rm $tarball
echo "You can now launch CentOS with the ./${bin} script"

0 comments on commit cda45e7

Please sign in to comment.