1
0
forked from x/ContextOS

opt favor

This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-03-04 16:45:21 +08:00
parent 17e1ce0f32
commit bddff57985
16 changed files with 536 additions and 77 deletions

View File

@ -1,12 +1,10 @@
export CGO_ENABLED=0 export CGO_ENABLED=0
binarys = bin/ice.bin binarys = bin/ice.bin
publish = usr/publish/ice.$(shell go env GOOS).$(shell go env GOARCH)
all: def all: def
@echo && date @date +"%Y-%m-%d %H:%M:%S"
go build -v -o ${binarys} src/main.go src/version.go src/binpack.go && ./${binarys} forever restart &>/dev/null go build -v -o ${binarys} src/main.go src/version.go src/binpack.go && ./${binarys} forever restart &>/dev/null
# mkdir -p $(dir ${publish}) &>/dev/null; rm ${publish} &>/dev/null; cp ${binarys} ${publish}
app: def app: def
CGO_ENABLED=1 go build -v -o usr/publish/contexts.app/Contents/MacOS/contexts src/webview.go src/version.go src/binpack.go && ./${binarys} forever restart &>/dev/null CGO_ENABLED=1 go build -v -o usr/publish/contexts.app/Contents/MacOS/contexts src/webview.go src/version.go src/binpack.go && ./${binarys} forever restart &>/dev/null
@ -14,8 +12,8 @@ app: def
# rm -f usr/publish/ContextsInstall.dmg # rm -f usr/publish/ContextsInstall.dmg
# hdiutil convert usr/publish/tmp.dmg -format UDZO -o usr/publish/ContextsInstall.dmg # hdiutil convert usr/publish/tmp.dmg -format UDZO -o usr/publish/ContextsInstall.dmg
%: src/%.go %: src/%.go def
@echo && date @date +"%Y-%m-%d %H:%M:%S"
go build -v -o usr/publish/$@ src/$@.go src/version.go && chmod u+x usr/publish/$@ go build -v -o usr/publish/$@ src/$@.go src/version.go && chmod u+x usr/publish/$@
def: def:

View File

@ -7,11 +7,12 @@ touch ~/.hushlogin
export CTX_ROOT=${CTX_ROOT:=~/contexts} export CTX_ROOT=${CTX_ROOT:=~/contexts}
[ "$PWD" = "$HOME" ] && cd ~/contexts [ "$PWD" = "$HOME" ] && cd ~/contexts
# export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
ish_sys_path_load ish_sys_path_load
ish_sys_cli_prompt ish_sys_cli_prompt
ish_sys_cli_alias vi vim ish_sys_cli_alias vi vim
ish_sys_cli_alias v vim
ish_sys_cli_alias t "tmux attach" ish_sys_cli_alias t "tmux attach"
ish_sys_cli_alias busybox "docker run -w /root -it busybox" ish_sys_cli_alias busybox "docker run -w /root -it busybox"
ish_sys_cli_alias alpine-dev "docker run -w /root -e 'LANG=en_US.UTF-8' -it alpine-dev sh" ish_sys_cli_alias alpine-dev "docker run -w /root -e 'LANG=en_US.UTF-8' -it alpine-dev sh"

View File

@ -33,13 +33,13 @@ ish_miss_prepare mysql-story
# ish_miss_prepare echarts # ish_miss_prepare echarts
# ish_miss_prepare icons # ish_miss_prepare icons
ish_miss_prepare go-sql-mysql # ish_miss_prepare go-sql-mysql
ish_miss_prepare go-qrcode # ish_miss_prepare go-qrcode
ish_miss_prepare creackpty # ish_miss_prepare creackpty
ish_miss_prepare websocket # ish_miss_prepare websocket
ish_miss_prepare webview # ish_miss_prepare webview
ish_miss_prepare gogit # ish_miss_prepare gogit
#
_prepare_ttc() { _prepare_ttc() {
ish_sys_link_create ~/.vim_local.vim $PWD/etc/conf/vim_local.vim ish_sys_link_create ~/.vim_local.vim $PWD/etc/conf/vim_local.vim
require dev/vim/vim.sh require dev/vim/vim.sh

View File

@ -8,13 +8,12 @@ usr/install/tmux-3.2/_install/bin
usr/install/git-2.31.1/_install/bin usr/install/git-2.31.1/_install/bin
usr/install/git-2.31.1/_install/libexec/git-core usr/install/git-2.31.1/_install/libexec/git-core
usr/install/vim-vim-12be734/_install/bin usr/install/vim-vim-12be734/_install/bin
usr/install/node-v16.15.1-darwin-x64/bin
usr/install/node-v16.15.1-linux-x64/bin
usr/install/jdk-18/bin
usr/install/docker
usr/install/ctags-5.8/_install/bin usr/install/ctags-5.8/_install/bin
usr/install/gcc-4.8.4/_install/bin usr/install/gcc-4.8.4/_install/bin
usr/install/gdb-7.6.1/_install/bin usr/install/gdb-7.6.1/_install/bin
usr/install/qemu-3.1.0/_install/bin usr/install/qemu-3.1.0/_install/bin
usr/install/ffmpeg-4.2.1/_install/bin usr/install/ffmpeg-4.2.1/_install/bin
usr/install/node-v16.15.1-darwin-x64/bin
usr/install/node-v16.15.1-linux-x64/bin
usr/install/jdk-18/bin
usr/install/docker

16
go.mod
View File

@ -16,14 +16,14 @@ replace (
shylinux.com/x/toolkits => ./usr/toolkits shylinux.com/x/toolkits => ./usr/toolkits
) )
replace ( // replace (
shylinux.com/x/creackpty => ./usr/creackpty // shylinux.com/x/creackpty => ./usr/creackpty
shylinux.com/x/go-qrcode => ./usr/go-qrcode // shylinux.com/x/go-qrcode => ./usr/go-qrcode
shylinux.com/x/go-sql-mysql => ./usr/go-sql-mysql // shylinux.com/x/go-sql-mysql => ./usr/go-sql-mysql
shylinux.com/x/gogit => ./usr/gogit // shylinux.com/x/gogit => ./usr/gogit
shylinux.com/x/websocket => ./usr/websocket // shylinux.com/x/websocket => ./usr/websocket
shylinux.com/x/webview => ./usr/webview // shylinux.com/x/webview => ./usr/webview
) // )
require ( require (
shylinux.com/x/golang-story v0.5.8 shylinux.com/x/golang-story v0.5.8

13
go.sum
View File

@ -1 +1,12 @@
shylinux.com/x/creackpty v0.0.2 h1:1ekWD5zeKZiQZCYvKSkHnm819wryZxzoq3kmvheC7bA=
shylinux.com/x/creackpty v0.0.2/go.mod h1:SOsAaW5FdicXUprrxgENk2JP1f8LdHBXZjqOFot488o=
shylinux.com/x/go-qrcode v0.0.2 h1:/c0PLj+1RT+kUPfnZVXwgbgH5m1SxBUjM2MIKXbDk+E=
shylinux.com/x/go-qrcode v0.0.2/go.mod h1:TlzGBENHXy19xC3AsC6h4Vs5fx2ZuDA4TZ0U3C2OeK4=
shylinux.com/x/go-sql-mysql v0.0.1 h1:VX5SrwLBKzfkRouj39LgJ9reIXOWmMsScRpr+e0qdp0=
shylinux.com/x/go-sql-mysql v0.0.1/go.mod h1:47OfAZK24HRJMy7dAu/jrksGCf9yzJaAUFwWYjhDFDA=
shylinux.com/x/gogit v0.0.7 h1:2ep5QpXWLs0UBCywJuUHda/aagskYvFmn0nj3vpEdY4=
shylinux.com/x/gogit v0.0.7/go.mod h1:wYfHxpQT1C8yNV+yC1jStIy0I12bfUCyJARhn0sNn1M=
shylinux.com/x/websocket v0.0.2 h1:aeeZyAsh6QN7+l5oMXlO9/rlQgx6CHvDtpZyAqMCSlU=
shylinux.com/x/websocket v0.0.2/go.mod h1:yMcu4XS6JB11YRISXwvubh7dPM6rWPdzIRv0CrshQBY=
shylinux.com/x/webview v0.0.2 h1:T0f2sDdiMCdDPjYwD1WS64ASBGwvZKPZkxDQ84d+ZQs=
shylinux.com/x/webview v0.0.2/go.mod h1:QJwPiwlFlvrntxO4Q3X0bj3Z1ysGRDiy7MZ8hYUmJ9g=

View File

@ -16,14 +16,14 @@ replace (
shylinux.com/x/toolkits => ./usr/toolkits shylinux.com/x/toolkits => ./usr/toolkits
) )
replace ( // replace (
shylinux.com/x/creackpty => ./usr/creackpty // shylinux.com/x/creackpty => ./usr/creackpty
shylinux.com/x/go-qrcode => ./usr/go-qrcode // shylinux.com/x/go-qrcode => ./usr/go-qrcode
shylinux.com/x/go-sql-mysql => ./usr/go-sql-mysql // shylinux.com/x/go-sql-mysql => ./usr/go-sql-mysql
shylinux.com/x/gogit => ./usr/gogit // shylinux.com/x/gogit => ./usr/gogit
shylinux.com/x/websocket => ./usr/websocket // shylinux.com/x/websocket => ./usr/websocket
shylinux.com/x/webview => ./usr/webview // shylinux.com/x/webview => ./usr/webview
) // )
require ( require (
shylinux.com/x/golang-story v0.5.8 shylinux.com/x/golang-story v0.5.8

View File

@ -1 +1,12 @@
shylinux.com/x/creackpty v0.0.2 h1:1ekWD5zeKZiQZCYvKSkHnm819wryZxzoq3kmvheC7bA=
shylinux.com/x/creackpty v0.0.2/go.mod h1:SOsAaW5FdicXUprrxgENk2JP1f8LdHBXZjqOFot488o=
shylinux.com/x/go-qrcode v0.0.2 h1:/c0PLj+1RT+kUPfnZVXwgbgH5m1SxBUjM2MIKXbDk+E=
shylinux.com/x/go-qrcode v0.0.2/go.mod h1:TlzGBENHXy19xC3AsC6h4Vs5fx2ZuDA4TZ0U3C2OeK4=
shylinux.com/x/go-sql-mysql v0.0.1 h1:VX5SrwLBKzfkRouj39LgJ9reIXOWmMsScRpr+e0qdp0=
shylinux.com/x/go-sql-mysql v0.0.1/go.mod h1:47OfAZK24HRJMy7dAu/jrksGCf9yzJaAUFwWYjhDFDA=
shylinux.com/x/gogit v0.0.7 h1:2ep5QpXWLs0UBCywJuUHda/aagskYvFmn0nj3vpEdY4=
shylinux.com/x/gogit v0.0.7/go.mod h1:wYfHxpQT1C8yNV+yC1jStIy0I12bfUCyJARhn0sNn1M=
shylinux.com/x/websocket v0.0.2 h1:aeeZyAsh6QN7+l5oMXlO9/rlQgx6CHvDtpZyAqMCSlU=
shylinux.com/x/websocket v0.0.2/go.mod h1:yMcu4XS6JB11YRISXwvubh7dPM6rWPdzIRv0CrshQBY=
shylinux.com/x/webview v0.0.2 h1:T0f2sDdiMCdDPjYwD1WS64ASBGwvZKPZkxDQ84d+ZQs=
shylinux.com/x/webview v0.0.2/go.mod h1:QJwPiwlFlvrntxO4Q3X0bj3Z1ysGRDiy7MZ8hYUmJ9g=

18
src/h2/h2.sh Normal file
View File

@ -0,0 +1,18 @@
#!/bin/sh
# set -v
# export ISH_CONF_LEVEL="require request notice debug alias"
# require "h3.sh"
require "src/h2/h3.sh"
require "src/h2/h3.sh?welcome=hi"
require "shylinux.com/x/contexts/src/hi/he.sh"
# require "http://localhost:9020/x/contexts/src/hi/he.sh"
# require "http://localhost:9020/x/contexts@v2.9.3/src/hi/he.sh"
demo() {
echo "hello world"
}
demo
demo1
request nfs.dir
ish_sys_cli_shell

411
src/hi/cmds.sh Normal file
View File

@ -0,0 +1,411 @@
[
[[
bc
expr
test
true
false
printf
clear
echo
time
flock
getopt
script
scriptreplay
usleep
sleep
timeout
nohup
xargs
tee
env
printenv
tty
stty
busybox
add-shell
remove-shell
ash
sh
ps
top
watch
pidof
pstree
renice
nice
setsid
setuidgid
kill
pkill
pgrep
killall
killall5
free
lsof
fuser
ls
ln
cp
mv
rm
rmdir
mkdir
mknod
mktemp
mkfifo
touch
truncate
link
unlink
readlink
stat
pwd
dirname
basename
vi
ed
tr
wc
od
seq
factor
cat
tac
rev
cut
sed
awk
cmp
comm
head
tail
more
less
sort
diff
fold
uniq
paste
split
ascii
expand
unexpand
xxd
hexdump
hexedit
strings
patch
sum
crc32
base32
base64
md5sum
sha1sum
sha3sum
sha256sum
sha512sum
uudecode
uuencode
dos2unix
unix2dos
df
du
dd
hd
cpio
find
grep
egrep
fgrep
fsync
cksum
eject
mount
umount
mountpoint
findfs
mkdosfs
fdisk
mke2fs
fsck
fsfreeze
fsck.minix
freeramdisk
mkfs.ext2
mkfs.minix
mkfs.vfat
chattr
iostat
xz
xzcat
bzcat
zcat
unzip
bzip2
bunzip2
gunzip
gzip
unxz
arch
tar
ar
ifconfig
ifdown
ifup
arp
arping
ping
ping6
traceroute
traceroute6
route
ntpd
dnsd
dnsdomainname
nslookup
ipaddr
ip
nc
netstat
hostname
telnetd
telnet
whois
tftp
tftpd
ftpd
ftpget
ftpput
wget
blkdiscard
blkid
chat
blockdev
id
adduser
addgroup
delgroup
deluser
passwd
chpasswd
whoami
groups
users
su
w
who
last
login
logname
sendmail
mesg
chown
chgrp
chmod
getty
beep
init
halt
reboot
runlevel
adjtimex
hwclock
uptime
logger
dmesg
syslogd
sysctl
chroot
crond
crontab
lsmod
rmmod
insmod
depmod
modinfo
modprobe
cal
date
uname
which
man
acpid
bootchartd
brctl
chpst
chrt
chvt
conspy
cryptpw
cttyhack
dc
deallocvt
devmem
dhcprelay
dpkg
dpkg-deb
dumpkmap
dumpleases
envdir
envuidgid
ether-wake
fakeidentd
fallocate
fatattr
fbset
fbsplash
fdflush
fdformat
fgconsole
fstrim
getconf
hdparm
hostid
httpd
hush
i2cdetect
i2cdump
i2cget
i2cset
i2ctransfer
ifenslave
ifplugd
inetd
install
ionice
ipcalc
ipcrm
ipcs
iplink
ipneigh
iproute
iprule
iptunnel
kbd_mode
klogd
linux32
linux64
linuxrc
loadfont
loadkmap
logread
losetup
lpd
lpq
lpr
lsattr
lspci
lsscsi
lsusb
lzcat
lzma
lzop
makedevs
makemime
mdev
microcom
mim
mkpasswd
mkswap
mpstat
mt
nameif
nanddump
nandwrite
nbd-client
nl
nmeter
nologin
nproc
nsenter
openvt
partprobe
pipe_progress
pivot_root
pmap
popmaildir
poweroff
powertop
pscan
pwdx
raidautorun
rdate
rdev
readahead
readprofile
realpath
reformime
reset
resize
resume
rpm
rpm2cpio
rtcwake
run-init
run-parts
runsv
runsvdir
rx
setarch
setconsole
setfattr
setfont
setkeycodes
setlogcons
setpriv
setserial
showkey
shred
shuf
slattach
smemcap
softlimit
ssl_client
start-stop-daemon
sulogin
sv
svc
svlogd
svok
swapoff
swapon
switch_root
sync
taskset
tc
tcpsvd
ts
ttysize
tunctl
ubiattach
ubidetach
ubimkvol
ubirename
ubirmvol
ubirsvol
ubiupdatevol
udhcpc
udhcpc6
udhcpd
udpsvd
uevent
unlzma
unshare
vconfig
vlock
volname
wall
watchdog
yes
zcip

View File

@ -2,8 +2,7 @@
show() { show() {
echo "$SHELL $TERM $PWD $HOME" echo "$SHELL $TERM $PWD $HOME"
echo "$PATH"|tr ":" "\n"
echo "$ISH_CTX_SCRIPT <= $ISH_CTX_MODULE"
echo "hello world $content $@" echo "hello world $content $@"
ish_sys_path_list
} }
show show

View File

@ -6,5 +6,5 @@ echo "hello world $content $@"
require "he.sh?content=what" nice require "he.sh?content=what" nice
require "/require/shylinux.com/x/contexts@v2.9.3/src/hi/he.sh" require "/require/shylinux.com/x/contexts@v2.9.3/src/hi/he.sh"
require "http://192.168.10.8:9020/require/shylinux.com/x/contexts@v2.9.3/src/hi/he.sh" require "http://192.168.10.8:9020/x/contexts@v2.9.3/src/hi/he.sh"
# require "https://shylinux.com/x/contexts@v2.9.3/src/hi/he.sh?content=what" # require "https://shylinux.com/x/contexts@v2.9.3/src/hi/he.sh?content=what"

View File

@ -1,4 +0,0 @@
package hi
func init() {
}

View File

@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
require "shylinux.com/x/contexts/src/h2/h2.sh"
main() { main() {
case "$1" in case "$1" in
app) # 生产环境 app) # 生产环境

View File

@ -1,25 +0,0 @@
package main
import "fmt"
func helper(chunks [][]string, chunkIndex int, prev []string, res [][]string) [][]string {
chunk := chunks[chunkIndex]
isLast := chunkIndex == len(chunks)-1
for _, val := range chunk {
if cur := append(prev, val); isLast {
res = append(res, cur)
} else {
res = helper(chunks, chunkIndex+1, cur, res)
}
}
return res
}
func combine(chunks ...[]string) (res [][]string) {
return helper(chunks, 0, []string{}, res)
}
func main() {
names := []string{"iPhone X", "iPhone XS"}
colors := []string{"黑色", "白色"}
storage := []string{"64g", "256g"}
fmt.Println(combine(names, colors, storage))
}

View File

@ -7,22 +7,22 @@
"type": "link" "type": "link"
} }
}, },
"1b610e": {
"meta": {
"name": "192.168.8.187:9020",
"text": "http://192.168.8.187:9020/?debug=true",
"time": "2023-03-01 11:24:16",
"type": "link"
}
},
"284e68": { "284e68": {
"meta": { "meta": {
"name": "192.168.8.145:9020", "name": "192.168.8.145:9020",
"text": "http://192.168.8.145:9020/chat/cmd/web.code.vimer?debug=true#usr/webview/:webview_test.go:1", "text": "http://192.168.8.145:9020/chat/cmd/web.code.vimer?debug=true",
"time": "2023-03-01 11:22:15", "time": "2023-03-01 11:22:15",
"type": "link" "type": "link"
} }
}, },
"2b0c19": {
"meta": {
"name": "alpine",
"text": "docker run -w /root -e 'LC_ALL=en_US.UTF-8' -it alpine",
"time": "2023-03-04 12:39:07",
"type": "shell"
}
},
"3d8fb3": { "3d8fb3": {
"meta": { "meta": {
"name": "192.168.8.1", "name": "192.168.8.1",
@ -38,5 +38,43 @@
"time": "2023-03-01 12:06:48", "time": "2023-03-01 12:06:48",
"type": "link" "type": "link"
} }
},
"723b5b": {
"meta": {
"name": "busybox",
"text": "docker run -w /root -it busybox",
"time": "2023-03-04 12:34:00",
"type": "shell"
}
},
"938ac4": {
"meta": {
"name": "contexts.com.cn",
"text": "https://contexts.com.cn",
"time": "2023-03-04 15:25:59",
"type": "link"
}
},
"acf002": {
"meta": {
"text": "src/h2/h2.sh",
"time": "2023-03-04 13:07:07",
"type": "file"
}
},
"adb5dd": {
"meta": {
"text": "web.code.xterm",
"time": "2023-03-04 13:08:04",
"type": "index"
}
},
"c1220f": {
"meta": {
"name": "shylinux.com",
"text": "https://shylinux.com",
"time": "2023-03-04 15:25:45",
"type": "link"
}
} }
} }