0.0.1 version of orangepi-pc SimpleLinux

This commit is contained in:
wt
2024-12-05 03:02:07 +07:00
parent d8f78baff0
commit 29af752d10
60 changed files with 6170 additions and 7732 deletions
-6
View File
@@ -1,6 +0,0 @@
set timeout=5
menuentry 'Simple Linux Install Media' {
linux /boot/vmlinuz-linux root=/dev/sda
initrd /boot/initramfs.img
}
-1
View File
@@ -1 +0,0 @@
# disk mountpoint filesystem options 0 0/1
-1
View File
@@ -1 +0,0 @@
root:x:0:root
-1
View File
@@ -1 +0,0 @@
simple
-3
View File
@@ -1,3 +0,0 @@
127.0.0.1 localhost
::1 localhost
127.0.1.1 simple.localdomain simple
-82
View File
@@ -1,82 +0,0 @@
#!/bin/sh
#--- reset colors ---
RESET="\033[0m"
#--------------------
#--------- regularcolrs ---------
GREEN="\033[0;32m" #GREEN
BLUE="\033[0;34m" #BLUE
YELLOW="\033[1;33m" #YELLOW
RED="\033[0;31m" #RED
BLACK="\033[0;30m" #BLACK
PURPLE="\033[0;35m" #PURPLE
CYAN="\033[0;36m" #CYAN
WHITE="\033[0;37m" #WHITE
#--------------------------------
#-------- bold ------------------
BBLACK="\033[1;30m" #BLACK
BRED="\033[1;31m" #RED
BGREEN="\033[1;32m" #GREEN
BYELLOW="\033[1;33m" #YELLOW
BBLUE="\033[1;34m" #BLUE
BPURPLE="\033[1;35m" #PURPLE
BCYAN="\033[1;36m" #CYAN
BWHITE="\033[1;37m" #WHITE
#--------------------------------
#-------- Underline -------------
UBLACK="\033[4;30m" #BLACK
URED="\033[4;31m" #RED
UGREEN="\033[4;32m" #GREEN
UYELLOW="\033[4;33m" #YELLOW
UBLUE="\033[4;34m" #BLUE
UPURPLE="\033[4;35m" #PURPLE
UCYAN="\033[4;36m" #CYAN
UWHITE="\033[4;37m" #WHITE
#--------------------------------
#--------- Background -----------
ON_BLACK="\033[40m" #BLACK
ON_RED="\033[41m" #RED
ON_GREEN="\033[42m" #GREEN
ON_YELLOW="\033[43m" #YELLOW
ON_BLUE="\033[44m" #BLUE
ON_PURPLE="\033[45m" #PURPLE
ON_CYAN="\033[46m" #CYAN
ON_WHITE="\033[47m" #WHITE
#--------------------------------
#------ HighIntensity -----------
IBLACK="\033[0;90m" #BLACK
IRED="\033[0;91m" #RED
IGREEN="\033[0;92m" #GREEN
IYELLOW="\033[0;93m" #YELLOW
IBLUE="\033[0;94m" #BLUE
IPURPLE="\033[0;95m" #PURPLE
ICYAN="\033[0;96m" #CYAN
IWHITE="\033[0;97m" #WHITE
#--------------------------------
#------ BoldHighIntensity -------
BIBLACK="\033[1;90m" #BLACK
BIRED="\033[1;91m" #RED
BIGREEN="\033[1;92m" #GREEN
BIYELLOW="\033[1;93m" #YELLOW
BIBLUE="\033[1;94m" #BLUE
BIPURPLE="\033[1;95m" #PURPLE
BICYAN="\033[1;96m" #CYAN
BIWHITE="\033[1;97m" #WHITE
#--------------------------------
#--- HighIntensitybackgrounds ---
ON_IBLACK="\033[0;100m" #BLACK
ON_IRED="\033[0;101m" #RED
ON_IGREEN="\033[0;102m" #GREEN
ON_IYELLOW="\033[0;103m" #YELLOW
ON_IBLUE="\033[0;104m" #BLUE
ON_IPURPLE="\033[0;105m" #PURPLE
ON_ICYAN="\033[0;106m" #CYAN
ON_IWHITE="\033[0;107m" #WHITE
#--------------------------------
-44
View File
@@ -1,44 +0,0 @@
#!/bin/sh
#--- import colors ---
. /etc/init.d/funcs/colors.sh
#---------------------
#---------------------- rc function to poweron or poweroff ------------
rc() {
if [ -d /etc/rc.d ] && [ $0 == "/etc/init.d/rcK" ]; then
for i in $(ls -r /etc/rc.d); do
/etc/rc.d/$i stop
done
return 1
fi
for i in /etc/rc.d/??*; do
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
$i start
;;
esac
done
sleep 1
# clear
return 1
}
#----------------------------------------------------------------------
#---------- check status function -----------
check() {
if [ $1 -ne 0 ]; then
printf "$BBLUE**$BRED ERROR: $2\n$RESET"
return
fi
printf "$BBLUE**$BGREEN SUCCESS: $2\n$RESET"
}
#--------------------------------------------
-18
View File
@@ -1,18 +0,0 @@
#!/bin/sh
. /etc/init.d/funcs/colors.sh
. /etc/init.d/funcs/init-funcs
case "$1" in
start)
printf "$BBLUE**$BYELLOW Setting up hostname\n$RESET"
/bin/hostname -F /etc/hostname
check $? "Set up hostname"
;;
stop)
;;
*)
echo "$0 init script usage: $0 {start}"
return 1
esac
return $?
-29
View File
@@ -1,29 +0,0 @@
#!/bin/sh
. /etc/init.d/funcs/init-funcs
. /etc/init.d/funcs/colors.sh
case "$1" in
start)
printf "$BBLUE**$BYELLOW Starting networking\n$RESET"
/sbin/ifup -a &> /dev/null
check $? "networking"
echo $! > /var/run/networking.pid
;;
stop)
printf "$BBLUE**$BYELLOW Stopping netowrking\n$RESET"
/sbin/ifdown -a
check $? "Stop networking"
if [ -f /var/run/networking.pid ]; then
rm /var/run/networking.pid
fi
;;
restart|reload)
$0 stop
$0 start
;;
*)
echo "$0 init script usage: $0 {start|stop|restart|reload}"
return 1
esac
return $?
-1
View File
@@ -1 +0,0 @@
rcS
-3
View File
@@ -1,3 +0,0 @@
#!/bin/sh
. /etc/init.d/funcs/init-funcs
rc
-27
View File
@@ -1,27 +0,0 @@
#!/bin/sh
. /etc/init.d/funcs/init-funcs
. /etc/init.d/funcs/colors.sh
case "$1" in
start)
printf "$BBLUE**$BYELLOW Mounting virtual filesystems\n$RESET"
mount -t tmpfs tmpfs /var/run
check $? "Mount virtual filesystems"
echo $! > /var/run/networking.pid
;;
stop)
printf "$BBLUE**$BYELLOW Umounting virtual filesystems\n$RESET"
umount /var/run
check $? "Umount virtual filesystems"
rm /var/run/networking.pid
;;
restart|reload)
$0 stop
$0 start
;;
*)
echo "$0 init script usage: $0 {start|stop|restart|reload}"
return 1
esac
return $?
-9
View File
@@ -1,9 +0,0 @@
::sysinit:/etc/init.d/rcS
::ctrlaltdel:/sbin/reboot
::shutdown:/etc/init.d/rcK
tty1::respawn:/sbin/getty 38400 tty1
tty2::askfirst:/sbin/getty 38400 tty2
tty3::askfirst:/sbin/getty 38400 tty3
tty4::askfirst:/sbin/getty 38400 tty4
-1
View File
@@ -1 +0,0 @@
\h \r (\l)
-4
View File
@@ -1,4 +0,0 @@
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
-11
View File
@@ -1,11 +0,0 @@
passwd: files
group: files
shadow: files
hosts: files dns
networks: files
protocols: files
services: files
ethers: files
rpc: files
-1
View File
@@ -1 +0,0 @@
root:x:0:0:root:/root:/bin/sh
-11
View File
@@ -1,11 +0,0 @@
export RESET="\033[0m"
export GREEN="\033[1;32m"
export BLUE="\033[1;34m"
export RED="\033[1;31m"
export YELLOW="\033[1;33m"
export PS1="$BLUE**$BLUE \u$RESET@$RED\h: $GREEN\w $YELLOW\$(date +%d.%m.%Y) \t\n$GREEN\$ $RESET"
[ $(id -u) -eq 0 ] && export PS1="$RED** \u@\h: \w \$(date +%d.%m.%Y) \t\n\\\$ $RESET"
[ -f ~/.profile ] && source ~/.profile
-1
View File
@@ -1 +0,0 @@
../init.d/virtualfilesystems
-1
View File
@@ -1 +0,0 @@
../init.d/hostname
-1
View File
@@ -1 +0,0 @@
../init.d/networking
-1
View File
@@ -1 +0,0 @@
nameserver 10.0.2.3
-1
View File
@@ -1 +0,0 @@
root:F.fHA5x2Q.xNY:19797::::::
-2
View File
@@ -1,2 +0,0 @@
/bin/sh
/bin/ash
+37
View File
@@ -0,0 +1,37 @@
#!/bin/sh
init=/sbin/init
root=
rootdelay=
rootfstype=auto
ro="ro"
rootflags=
device=
resume=
noresume=false
mount -n -t devtmpfs devtmpfs /dev
mount -n -t proc proc /proc
mount -n -t sysfs sys /sys
mount -n -t tmpfs run /run
mkdir -p /dev/pts
read -r cmdline < /proc/cmdline
for param in $cmdline ; do
case $param in
init=* ) init=${param#init=} ;;
root=* ) root=${param#root=} ;;
rootdelay=* ) rootdelay=${param#rootdelay=} ;;
rootfstype=*) rootfstype=${param#rootfstype=} ;;
rootflags=* ) rootflags=${param#rootflags=} ;;
resume=* ) resume=${param#resume=} ;;
noresume ) noresume=true ;;
ro ) ro="ro" ;;
rw ) ro="rw" ;;
esac
done
echo 0 > /proc/sys/kernel/printk
exec /sbin/init
+2 -1
View File
@@ -26,4 +26,5 @@ usr/share
usr/src
var
var/log
var/run
var/run
tmp
-287
View File
@@ -1,287 +0,0 @@
#!/bin/sh
########## #### ####
########## #### ####
## ## ## ## ## ##
## ## ## ## ## ##
########## ## ## ## - PACKAGE MANAGER FOR SIMPLE LINUX
########## ## ## ## - AUTHOR -- TOLA MIRONCENKO
## ## ##
## ## ##
## ## ##
## ## ##
#----- colors -------
Green='\033[0;32m'
Color_off='\033[0m'
Red='\033[0;31m'
Bred='\033[1;31m'
Yellow='\033[1;33m'
White='\033[0;37m'
Bwhite='\033[1;37m'
#--------------------
#---------------- variables --------------------------
rootdir=/
repofile=$rootdir/etc/pm/repo
packagesqueryfile=$rootdir/usr/share/pm/query
reposquerydir=$rootdir/usr/share/pm/repos
cachedpkgdir=$rootdir/var/cache/pm/pkg
installedpackagesdir=$rootdir/usr/share/pm/packages
#-----------------------------------------------------
#---------------- check root priveleges function ------------------------
checkroot() {
if [[ $(id -u) != 0 ]]; then
printf "$Yellow**$Bred error:$Color_off you must be root\n"
exit 1
fi
}
checkroot
#------------------------------------------------------------------------
#----------------- add(install) package function ------------------------
add() {
if [[ "$1" == "" ]]; then
help
exit 0
fi
for i in $*; do
if [[ "$i" == "add" ]]; then
continue
fi
done
for i in $*; do
if [[ "$i" == "add" ]]; then
continue
fi
down $i
done
for i in $*; do
if [[ "$i" == "add" ]]; then
continue
fi
unpack $cachedpkgdir/$i.pkg.gz
done
}
#------------------------------------------------------------------------
#-------------------- download package without install function ---------
down() {
if [[ ! $1 ]]; then
help
exit 0
fi
servers=$(cat $repofile)
for i in $servers; do
serverdir=$(echo $i | sed -e "/http:\/\//s///")
repoquery=$(cat $reposquerydir/$serverdir/query | sed -e '/.pkg.gz/s///')
for j in $repoquery; do
if [[ $j == $1 ]]; then
if [ ! -f $cachedpkgdir/$1.pkg.gz ]; then
printf "$Yellow**$Color_off Downloading $Yellow$serverdir: $Bwhite$j\n$Color_off"
wget $i/$1.pkg.gz -P $cachedpkgdir
if [[ "$?" == "0" ]]; then
printf "$Yellow**$Green successful downloaded $1\n$Color_off"
return
else
printf "$Yellow**$Red error:$Color_off can't download package\n"
exit 1
fi
else
printf "$Yellow**$Green successful downloaded $1\n$Color_off"
return
fi
# exit 0
fi
done
done
printf "$Yellow**$Red error:$Color_off can't find package $1\n"
exit 1
}
#------------------------------------------------------------------------
#-------------------- unpack local package archive ----------------------
unpack() {
packagename=$(echo $1 | sed -e "/.gz/s///")
packagename=${packagename#*pkg/}
printf "$Yellow**$Green Installing ${packagename%.pkg*}\n$Color_off"
if [[ "$(cat $packagesqueryfile | grep ${packagename%.pkg*})" != "" ]]; then
printf "$Yellow**$Color_off Package already installed:$Yellow reinstalling\n"
fi
tar -xvf $1 -C $rootdir/tmp &> /dev/null
cd $rootdir/tmp/$packagename
mkdir $installedpackagesdir/$packagename &> /dev/null
mv -v list $installedpackagesdir/$packagename &> /dev/null
cp -rv ./* $rootdir &> /dev/null
if [ -f $rootdir/tmp/$packagename/post_install ]; then
sh -c $rootdir/tmp/$packagename/post_install
fi
if [[ "$(cat $packagesqueryfile | grep ${packagename%.pkg*})" == "" ]]; then
echo ${packagename%.pkg*} >> $packagesqueryfile
fi
rm -rv $rootdir/tmp/$packagename &> /dev/null
printf "$Yellow**$Green Installed ${packagename%.pkg*} successful\n$Color_off"
}
#------------------------------------------------------------------------
#------------------ delete package function -----------------------------
del() {
printf "$Yellow**$Green deleting\n$Color_off"
for i in $*; do
if [[ "$i" == "del" ]]; then
continue
fi
printf "$Yellow**$Green deleting $i\n$Color_off"
if [ ! -f $installedpackagesdir/$i.pkg/list ]; then
printf "$Yellow**$Bred error:$Color_off package not installed\n"
exit 0
fi
rm -v $rootdir/$(cat $installedpackagesdir/$i.pkg/list) &> /dev/null
rm -rv $installedpackagesdir/$i.pkg &> /dev/null
sed -i "/$i/d" $packagesqueryfile
printf "$Yellow**$Green delete $i successful\n$Color_off"
done
}
#------------------------------------------------------------------------
#------------------- list files in package function ---------------------
list() {
if [[ "$1" == "" ]]; then
help
exit 0
fi
if [[ "$(cat $packagesqueryfile | grep $1)" == "" ]]; then
printf "$Yellow**$Bred error:$Color_off package is not installed\n"
exit 1
fi
filelist=$(cat $installedpackagesdir/$1.pkg/list)
for i in $filelist; do
printf "$Yellow$1: $Bwhite$i$Color_off\n"
done
}
#------------------------------------------------------------------------
#------------------- show installed packages function -------------------
query() {
packagesquery=$(cat $packagesqueryfile)
if [[ "$packagesquery" == "" ]]; then
printf "$Yellow**$Bwhite No installed packages\n"
exit 0
fi
printf "$packagesquery\n"
}
#------------------------------------------------------------------------
#--------------------- show help function -------------------------------
help() {
printf "
$Yellow**$Green pm usage$Color_off :
$Bwhite pm add [package name] - download and install from repository
pm unpack [/path/to/package/archive] - unpack(install) from local package archive
pm down [package name] - download package from repository without install
pm del [package name] - delete package
pm list [package name] - list files in package
pm search [package name] - search package in repository
pm query - show installed packages
pm help - this help message
pm clear - clear all package archives from cached packages directory
pm sync - synchronize repository
$Yellow**$Green examples$Color_off :
$Bwhite pm add dnsmasq
pm unpack ./dnsmasq.pkg.gz
pm down dnsmasq
pm search dnsmasq
pm help
pm clear
pm sync
pm del dnsmasq
pm list dnsmasq
pm query
\n$Color_off"
}
#------------------------------------------------------------------------
#------------------- sync repo function ---------------------------------
sync() {
servers=$(cat $repofile)
for i in $servers; do
serverdir=$(echo $i | sed -e "/http:\//s///")
mkdir $reposquerydir/$serverdir &> /dev/null
wget $i/query -O $reposquerydir/$serverdir/query &> /dev/null
done
}
#------------------------------------------------------------------------
#----------------- search package in repo function ----------------------
search() {
servers=$(cat $repofile)
if [[ ! $1 ]]; then
for i in $servers; do
serverdir=$(echo $i | sed -e "/http:\/\//s///")
repoquery=$(cat $reposquerydir/$serverdir/query | sed -e '/.pkg.gz/s///')
for j in $repoquery; do
printf "$Yellow$serverdir: $Bwhite$j\n$Color_off"
done
done
exit 0
fi
for i in $servers; do
serverdir=$(echo $i | sed -e "/http:\/\//s///")
repoquery=$(cat $reposquerydir/$serverdir/query | sed -e '/.pkg.gz/s///')
for j in $repoquery; do
if [[ $j == $1 ]]; then
printf "$Yellow$serverdir: $Bwhite$j\n$Color_off"
exit 0
fi
done
done
printf "$Yellow**$Red error:$Color_off can't find package ($1)\n"
}
#------------------------------------------------------------------------
#------------------- clear cached packages directory --------------------
clear() {
rm -v $cachedpkgdir/*
}
#------------------------------------------------------------------------
case "$1" in
add)
add $*
;;
down)
down $2
;;
unpack)
unpack $2
;;
del)
del $*
;;
list)
list $2
;;
query)
query
;;
help)
help
;;
sync)
sync
;;
search)
search $2
;;
clear)
clear
;;
*)
help
;;
esac
-174
View File
@@ -1,174 +0,0 @@
#!/bin/sh
########## ##########
########## ##########
## ## ##
## ##
## ## - RC BOOT SCRIPTS MANAGER FOR SIMPLE LINUX
## ## - AUTHOR -- TOLA MIRONCENKO
## ##
## ##
## ##########
## ##########
#----- colors -------
Green='\033[0;32m'
Color_off='\033[0m'
Red='\033[0;31m'
Bred='\033[1;31m'
Yellow='\033[1;33m'
White='\033[0;37m'
Bwhite='\033[1;37m'
#--------------------
rootdir=/
#------------------------ add to boot function --------------
add() {
resultlink=$(cat /usr/share/rc/ordernumbers | grep $1)
if [ -f /etc/init.d/$1 ] && [ $resultlink ]; then
cd /etc/rc.d
ln -sv ../init.d/$1 "$resultlink" &> /dev/null
echo "added $1 to init."
else
help
fi
}
#------------------------------------------------------------
#--------------------- del from boot function ---------------
del() {
filetoremove=$(find /etc/rc.d/ | grep $1 )
if [ $filetoremove ]; then
rm -v $filetoremove &> /dev/null
echo "removed $1 from init."
else
help
fi
}
#------------------------------------------------------------
#---------------------- start daemon function ---------------
start() {
if [ -f /etc/init.d/$1 ]; then
/etc/init.d/$1 start
else
help
fi
}
#------------------------------------------------------------
#---------------- stop daemon function ----------------------
stop() {
if [ -f /etc/init.d/$1 ]; then
/etc/init.d/$1 stop
else
help
fi
}
#------------------------------------------------------------
#------------- restart daemon function ----------------------
restart() {
if [ -f /etc/init.d/$1 ]; then
/etc/init.d/$1 restart
else
help
fi
}
#------------------------------------------------------------
#------------------ list services ---------------------------
list() {
ls --color $rootdir/etc/init.d
}
#------------------------------------------------------------
#------------------ list enabled services -------------------
bootlist() {
ls --color $rootdir/etc/rc.d
}
#------------------------------------------------------------
#------------------ service status --------------------------
status() {
if [[ "$1" == "" ]]; then
help
exit 0
fi
if [[ "$(ls /etc/init.d | grep $1)" == "" ]]; then
printf "$Yellow**$Bred error:$Color_off can't find service /etc/init.d/$1\n"
exit 1
fi
printf "$Yellow**$Green $1$Color_off\n"
rcdservice=$(ls $rootdir/etc/rc.d | grep $1 2> /dev/null)
if [[ "$rcdservice" == "" ]]; then
printf "Loaded:$Yellow unloaded$Color_off (/etc/rc.d)\n"
else
printf "Loaded:$Green loaded$Color_off (/etc/rc.d/$rcdservice)\n"
fi
servicepid=$(ls $rootdir/var/run | grep $1)
if [[ "$servicepid" == "" ]]; then
printf "Active: deactive (${Yellow}deactive$Color_off)\n"
else
printf "Active: active (${Green}running$Color_off); pid (/var/run/$servicepid)\n"
fi
}
#------------------------------------------------------------
#-------------- print help function -------------------------
help() {
echo "
** rc usage:
rc add [init.d script name] - add service on boot
rc del [init.d script name] - delete service from boot
rc start [init.d script name] - start service
rc stop [init.d script name] - stop service
rc restart [init.d script name] - restart service
rc list - list all services
rc bootlist - list enabled services
rc status [init.d script name] - check service status
examples:
rc add httpd
rc del httpd
rc start httpd
rc stop httpd
rc restart httpd
rc list
rc bootlist
"
}
#------------------------------------------------------------
command="$1"
case ${command} in
add)
add $2 $3
;;
del)
del $2
;;
start)
start $2
;;
stop)
stop $2
;;
restart)
restart $2
;;
list)
list
;;
bootlist)
bootlist
;;
status)
status $2
;;
*)
help
;;
esac
-64
View File
@@ -1,64 +0,0 @@
#!/bin/sh
. /etc/init.d/funcs/colors.sh
[ -z "$1" ] && printf "$URED** ERROR: should be called from udhcpc\n$RESET" && exit 1
RESOLF_CONF="/etc/resolv.conf"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
# return 0 if root is mounted on a network filesystem
root_if_nfs() {
grep -qe '^/dev/root.*\(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
}
have_bin_ip=0
if [ -x /bin/ip ]; then
have_bin_ip=1
fi
case "$1" in
deconfig)
if ! rootfs_is_nfs; then
if [ $have_bin_ip -eq 1 ]; then
ip a flush dev $interface
ip l set dev $interface up
else
/sbin/ifconfig $interface 0.0.0.0
fi
fi
;;
renew|bound)
if [ $have_bin_ip -eq 1 ]; then
ip a add dev $interface local $ip/$mask $BROADCAST
else
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
fi
if [ -n "$router" ]; then
if ! root_if_nfs; then
if [ $have_bin_ip -eq 1 ]; then
while ip r del default 2>/dev/null; do
:
done
else
while route del default gw 0.0.0.0 dev $interface 2>/dev/null; do
:
done
fi
fi
metric=0
for i in $router; do
if [ $have_bin_ip -eq 1 ]; then
ip r add default via $i metric $((metric++))
else
route add default gw $i dev $interface metric $((metric++)) 2>/dev/null
fi
done
fi
echo -n > $RESOLF_CONF
[ -n "$domain" ] && echo search $domain >> $RESOLF_CONF
for i in $dns; do
echo adding dns $i
echo nameserver $i >> $RESOLF_CONF
done
;;
esac
exit 0