This commit is contained in:
Fierelier 2022-08-10 02:00:49 +02:00
parent a8355dffb8
commit 557798e66e
89 changed files with 489 additions and 489 deletions

1
.gitignore vendored
View File

@ -1 +0,0 @@
chroots/

View File

@ -1,4 +1,4 @@
# opus-dvn
# windvn
Devuan Linux for Windows users
![Screenshot](assets/screenshot.png)

76
make-os
View File

@ -1,76 +0,0 @@
#!/bin/bash
set -e
cd "$(dirname "$(realpath -s "$BASH_SOURCE")")"
source shell
source "env-$1"
set +e
(
set -e
# export OPUS_OUTPUT="/media/zram"
export OPUS_IMAGEDIR_BASE="$OPUS_OUTPUT/$1/base"
export OPUS_IMAGEDIR_FINAL="$OPUS_OUTPUT/$1/final"
export OPUS_PACKAGES=""
export OPUS_PACKAGES_INTERACTIVE=""
export OPUS_PACKAGES_DL=""
export OPUS_PACKAGES_REMOVE=""
# Base
if [ -d "$OPUS_IMAGEDIR_BASE-tmp" ]; then
rm -f -r "$OPUS_IMAGEDIR_BASE-tmp"
fi
if ! [ -d "$OPUS_IMAGEDIR_BASE" ]; then
mkdir -p "$OPUS_IMAGEDIR_BASE-tmp"
make-base "$OPUS_IMAGEDIR_BASE-tmp" # Base image
source apply-mod "$OPUS_HOME/input/sources" "$OPUS_IMAGEDIR_BASE-tmp"
mv "$OPUS_IMAGEDIR_BASE-tmp" "$OPUS_IMAGEDIR_BASE"
fi
if [ -d "$OPUS_IMAGEDIR_FINAL-tmp" ]; then
rm -f -r "$OPUS_IMAGEDIR_FINAL-tmp"
fi
if ! [ -d "$OPUS_IMAGEDIR_FINAL" ]; then
echo "Copying base image ..."
cp -a "$OPUS_IMAGEDIR_BASE" "$OPUS_IMAGEDIR_FINAL-tmp"
echo "$OPUS_SOURCES" > "$OPUS_IMAGEDIR_FINAL-tmp/etc/apt/sources.list"
# Hardware
source apply-mod "$OPUS_HOME/mods/kernel" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/firmware-free" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/grub" "$OPUS_IMAGEDIR_FINAL-tmp"
# Graphical
source apply-mod "$OPUS_HOME/mods/packages-graphical" "$OPUS_IMAGEDIR_FINAL-tmp"
# Overrides
source apply-mod "$OPUS_HOME/mods/hostname" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/user-config" "$OPUS_IMAGEDIR_FINAL-tmp"
# Raw image
# source apply-mod "$OPUS_HOME/mods/image-raw" "$OPUS_IMAGEDIR_FINAL-tmp"
# Packages
source apply-mod "$OPUS_HOME/mods/fast-dpkg" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/packages-apply" "$OPUS_IMAGEDIR_FINAL-tmp"
# Extra
source apply-mod "$OPUS_HOME/mods/oobe" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/clean-logs" "$OPUS_IMAGEDIR_FINAL-tmp"
mv "$OPUS_IMAGEDIR_FINAL-tmp" "$OPUS_IMAGEDIR_FINAL"
# make-image-raw "$OPUS_IMAGEDIR_FINAL" "$OPUS_HOME/${OPUS_NAME}-${OPUS_DIST}-${OPUS_ARCH}_$(date "+%Y.%m.%d-%H.%M.%S").img"
# make-image-gz "$OPUS_IMAGEDIR" "$OPUS_OUTPUT/${OPUS_NAME}-${OPUS_DIST}-${OPUS_ARCH}_$(date "+%Y.%m.%d-%H.%M.%S").tar.gz" # tar.gz image
fi
echo ""
echo "Done."
)
if [ $? != 0 ]; then
set +e
echo "Script execution ended due to error. Cleaning up..."
fchroot-end "$OPUS_IMAGEDIR"
echo "Script execution ended due to error."
exit 1
fi

View File

@ -1,78 +0,0 @@
#!/bin/bash
set -e
cd "$(dirname "$(realpath -s "$BASH_SOURCE")")"
source shell
source "env-$1"
source "env-proprietary"
set +e
(
set -e
# export OPUS_OUTPUT="/media/zram"
export OPUS_IMAGEDIR_BASE="$OPUS_OUTPUT/$1/base"
export OPUS_IMAGEDIR_FINAL="$OPUS_OUTPUT/$1/final-proprietary"
export OPUS_PACKAGES=""
export OPUS_PACKAGES_INTERACTIVE=""
export OPUS_PACKAGES_DL=""
export OPUS_PACKAGES_REMOVE=""
# Base
if [ -d "$OPUS_IMAGEDIR_BASE-tmp" ]; then
rm -f -r "$OPUS_IMAGEDIR_BASE-tmp"
fi
if ! [ -d "$OPUS_IMAGEDIR_BASE" ]; then
mkdir -p "$OPUS_IMAGEDIR_BASE-tmp"
make-base "$OPUS_IMAGEDIR_BASE-tmp" # Base image
source apply-mod "$OPUS_HOME/input/sources" "$OPUS_IMAGEDIR_BASE-tmp"
mv "$OPUS_IMAGEDIR_BASE-tmp" "$OPUS_IMAGEDIR_BASE"
fi
if [ -d "$OPUS_IMAGEDIR_FINAL-tmp" ]; then
rm -f -r "$OPUS_IMAGEDIR_FINAL-tmp"
fi
if ! [ -d "$OPUS_IMAGEDIR_FINAL" ]; then
echo "Copying base image ..."
cp -a "$OPUS_IMAGEDIR_BASE" "$OPUS_IMAGEDIR_FINAL-tmp"
echo "$OPUS_SOURCES" > "$OPUS_IMAGEDIR_FINAL-tmp/etc/apt/sources.list"
# Hardware
source apply-mod "$OPUS_HOME/mods/kernel" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/firmware-free" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/firmware-proprietary" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/grub" "$OPUS_IMAGEDIR_FINAL-tmp"
# Graphical
source apply-mod "$OPUS_HOME/mods/packages-graphical" "$OPUS_IMAGEDIR_FINAL-tmp"
# Overrides
source apply-mod "$OPUS_HOME/mods/hostname" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/user-config" "$OPUS_IMAGEDIR_FINAL-tmp"
# Raw image
# source apply-mod "$OPUS_HOME/mods/image-raw" "$OPUS_IMAGEDIR_FINAL-tmp"
# Packages
source apply-mod "$OPUS_HOME/mods/fast-dpkg" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/packages-apply" "$OPUS_IMAGEDIR_FINAL-tmp"
# Extra
source apply-mod "$OPUS_HOME/mods/oobe" "$OPUS_IMAGEDIR_FINAL-tmp"
source apply-mod "$OPUS_HOME/mods/clean-logs" "$OPUS_IMAGEDIR_FINAL-tmp"
mv "$OPUS_IMAGEDIR_FINAL-tmp" "$OPUS_IMAGEDIR_FINAL"
# make-image-raw "$OPUS_IMAGEDIR_FINAL" "$OPUS_HOME/${OPUS_NAME}-${OPUS_DIST}-${OPUS_ARCH}_$(date "+%Y.%m.%d-%H.%M.%S").img"
# make-image-gz "$OPUS_IMAGEDIR" "$OPUS_OUTPUT/${OPUS_NAME}-${OPUS_DIST}-${OPUS_ARCH}_$(date "+%Y.%m.%d-%H.%M.%S").tar.gz" # tar.gz image
fi
echo ""
echo "Done."
)
if [ $? != 0 ]; then
set +e
echo "Script execution ended due to error. Cleaning up..."
fchroot-end "$OPUS_IMAGEDIR"
echo "Script execution ended due to error."
exit 1
fi

6
modlists/base Normal file
View File

@ -0,0 +1,6 @@
packages-base
hostname
sources
user-config
oobe
fast-dpkg

2
modlists/finish Normal file
View File

@ -0,0 +1,2 @@
packages-apply
placeholders-remove

1
modlists/graphical Normal file
View File

@ -0,0 +1 @@
graphical-general

1
modlists/graphical-xfce4 Normal file
View File

@ -0,0 +1 @@
graphical-xfce4

3
modlists/hardware Normal file
View File

@ -0,0 +1,3 @@
kernel
firmware
grub

1
modlists/hardware-live Normal file
View File

@ -0,0 +1 @@
live-boot

View File

@ -0,0 +1,2 @@
sources-proprietary
firmware-proprietary

View File

@ -1,2 +0,0 @@
#!/bin/bash
find "$1/var/log" -type f -delete

View File

@ -1,2 +0,0 @@
#!/bin/bash
export OPUS_PACKAGES="$OPUS_PACKAGES firmware-linux-free firmware-ath9k-htc"

View File

@ -7,7 +7,5 @@ function sfp {
packages="$packages ${packageinfo[0]}"
fi
done <<<$(apt-cache search "$1")
echo "${packages//"firmware-ipw2x00"/""}"
}
export OPUS_PACKAGES="$OPUS_PACKAGES firmware-linux firmware-misc-nonfree $(sfp wireless) $(sfp wifi) $(sfp net)"
export OPUS_PACKAGES_INTERACTIVE="$OPUS_PACKAGES_INTERACTIVE firmware-ipw2x00"
export WDVN_PACKAGES="$WDVN_PACKAGES firmware-linux firmware-misc-nonfree $(sfp wireless) $(sfp wifi) $(sfp net) firmware-ipw2x00"

2
mods/firmware/modscript Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
export WDVN_PACKAGES="$WDVN_PACKAGES firmware-linux-free firmware-ath9k-htc"

View File

@ -0,0 +1,3 @@
#!/bin/bash
export WDVN_PACKAGES_DL="$WDVN_PACKAGES_DL mousepad netsurf-gtk xautolock xsecurelock qt5-style-plugins alsa-utils synaptic epiphany-browser"
export WDVN_PACKAGES_REMOVE="$WDVN_PACKAGES_REMOVE xscreensaver"

2
mods/graphical-xfce4/modscript Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
export WDVN_PACKAGES_DL="$WDVN_PACKAGES_DL xorg xfce4 xfce4-*-plugin xfce4-power-manager gvfs gvfs-backends gvfs-fuse network-manager-gnome xfce4-terminal xfce4-screenshooter"

View File

@ -1,2 +1,2 @@
#!/bin/bash
export OPUS_PACKAGES="$OPUS_PACKAGES grub2"
export WDVN_PACKAGES="$WDVN_PACKAGES grub2"

View File

@ -1,7 +0,0 @@
#!/usr/bin/env bash
set -e
echo "GRUB_DISABLE_OS_PROBER=true" >>/etc/default/grub
grub-install --boot-directory="/boot" --modules=part_msdos "${DISK_LOOP}"
update-grub
sed -i 's/GRUB_DISABLE_OS_PROBER=true/# GRUB_DISABLE_OS_PROBER=true/' /etc/default/grub
rm /setupdisk

View File

@ -1,2 +0,0 @@
#!/bin/bash
export OPUS_PACKAGES="$OPUS_PACKAGES cloud-utils"

View File

@ -1,2 +1,2 @@
#!/usr/bin/env bash
export OPUS_PACKAGES="$OPUS_PACKAGES $OPUS_LINUX"
export WDVN_PACKAGES="$WDVN_PACKAGES $WDVN_KERNEL"

2
mods/live-boot/modscript Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
export WDVN_PACKAGES="$WDVN_PACKAGES live-boot live-boot-initramfs-tools"

View File

@ -1,143 +1,67 @@
#!/usr/bin/env python3
# This script is ran when booting into the OS, and the setup isn't finished
import os
import traceback
import subprocess
debug = False
os.environ["PATH"] = "/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
def procWait(proc):
rtn = proc.wait()
if debug: print(rtn)
if rtn != 0: raise processError
def call(*args,**kwargs):
if debug: print(str(args[0]))
proc = subprocess.Popen(*args,**kwargs)
procWait(proc)
def callo(*args,**kwargs):
data = b""
proc = subprocess.Popen(*args,**kwargs,stdout=subprocess.PIPE)
while True:
b = proc.stdout.read()
if b == b"": break
data += b
procWait(proc)
return data.decode("utf-8")
def mchoice(choices):
while True:
choice = input("Choice: ").lower()
if not choice in choices: continue
return choice
def main():
while True:
print("Welcome to opus-dvn.")
print("1: Finish installation")
print("2: Clone to other device")
print("3: Open bash")
print("4: Shut down")
choice = mchoice(["1","2","3","4"])
if choice == "1":
if os.path.isfile("/isRawImage"):
print("Resizing / to fill disk...")
dev = callo(["findmnt","-n","-o","SOURCE","/"]).strip("\t\r\n")
disk = dev[:-1]
part = dev[-1]
call(["growpart",disk,part])
call(["resize2fs",dev])
os.remove("/isRawImage")
call(["dpkg-reconfigure","keyboard-configuration"])
call(["udevadm","trigger","--subsystem-match=input","--action=change"])
call(["apt","install","console-setup","locales","tzdata","--yes"])
call(["dpkg-reconfigure","locales"])
call(["dpkg-reconfigure","tzdata"])
print("")
hostname = input("Hostname: ")
with open("/etc/hosts","w",encoding="utf-8") as fh:
fh.write("""\
127.0.0.1 localhost
#!/bin/bash
export PATH="/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
CHOICE=1
while true; do
echo "Welcome to windvn!"
echo "1: Finish installation"
echo "2: Open bash"
echo "3: Shut down"
read -p "Choice: " CHOICE
echo ""
if [ "$CHOICE" == "1" ]; then
dpkg-reconfigure keyboard-configuration
udevadm trigger --subsystem-match=input --action=change
apt -y install console-setup locales tzdata
dpkg-reconfigure locales
dpkg-reconfigure tzdata
groupadd -f sudo
while true; do
read -p "First user (Administrator): " NEW_USER
(
set -e
adduser --gecos "" "$NEW_USER"
usermod -a -G sudo "$NEW_USER"
)
if [ "$?" == "0" ]; then
break
else
deluser --remove-home "$NEW_USER"
echo ""
fi
done
for file in "/oobe/setupComplete"/*; do
if [[ -x "$file" ]]; then
source "$file"
fi
done
echo "$HOSTNAME" > /etc/hostname
echo "127.0.0.1 localhost
127.0.1.1 $HOSTNAME
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters\
""".replace("$HOSTNAME",hostname)
)
with open("/etc/hostname","w",encoding="utf-8") as fh:
fh.write(hostname)
os.environ["HOSTNAME"] = hostname
print("")
print("Configure your network now, using nmtui? (y/n)")
if mchoice(["y","n"]) == "y": call(["nmtui"])
print("")
call(["groupadd","-f","sudo"])
username = False
while True:
username = input("First user (Administrator): ").lower().strip(" ")
if username == "root": continue
print("Encrypt user? Recommended for machines that may be stolen or spying relatives. (y/n)")
encrypt = mchoice(["y","n"])
ucommand = ["adduser"]
ucommand = ucommand + ["--gecos","",username]
try:
call(["id","-u",username])
except:
try:
call(ucommand)
except:
try:
call(["deluser","--remove-home",username])
except:
continue
try:
call(["usermod","-a","-G","sudo",username])
except:
print("Warning: Couldn't add user to sudo group!")
if encrypt == "y":
call(["modprobe","ecryptfs"])
with open("/etc/modules","a",encoding="utf-8") as mfile:
mfile.write("ecryptfs\n")
call(["ecryptfs-migrate-home","-u",username])
for root,dirs,files in os.walk("/home"):
for files in dirs:
ffile = os.path.join(root,file)
lfile = ffile.replace("/home/","",1)
if lfile.startswith(username + "."):
shutil.rmtree(ffile)
break
break
print("")
print("Booting into new environment ...")
os.remove("/bin/login")
os.rename("/bin/login.bak","/bin/login")
return
ff02::2 ip6-allrouters
" > /etc/hosts
if choice == "2":
print("Not implemented.")
continue
if choice == "3":
call(["bash"])
return
if choice == "4":
call(["poweroff"])
return
try:
main()
except:
print(traceback.format_exc())
input("Press RETURN to quit.")
rm "/bin/login"
mv "/bin/login.bak" "/bin/login"
exit
fi
if [ "$CHOICE" == "2" ]; then
bash
fi
if [ "$CHOICE" == "3" ]; then
poweroff
exit
fi
echo ""
done

3
mods/oobe/modscript Executable file → Normal file
View File

@ -1,3 +1,2 @@
#!/bin/bash
export OPUS_PACKAGES="$OPUS_PACKAGES sudo keyboard-configuration network-manager python3 cloud-utils ecryptfs-utils rsync lsof"
export OPUS_PACKAGES_DL="$OPUS_PACKAGES console-setup locales tzdata"
cp "$1/bin/login" "$1/bin/login.bak"

View File

@ -1,10 +1,13 @@
#!/bin/bash
set -e
cat << EOF | debconf-set-selections
firmware-ipw2x00 firmware-ipw2x00/license/accepted boolean true
EOF
apt -y update
apt -y upgrade
apt -y install $WDVN_PACKAGES_INTERACTIVE
export DEBIAN_FRONTEND="noninteractive"
apt -y install $OPUS_PACKAGES
apt -y install --download-only $OPUS_PACKAGES_DL
apt -y install $WDVN_PACKAGES
apt -y install --download-only $WDVN_PACKAGES_DL
unset DEBIAN_FRONTEND
apt -y install $OPUS_PACKAGES_INTERACTIVE
apt -y remove $OPUS_PACKAGES_REMOVE
apt -y autoclean

View File

@ -0,0 +1,7 @@
#!/bin/bash
echo "#!/bin/bash
apt -y install $WDVN_PACKAGES_DL
apt -y remove $WDVN_PACKAGES_REMOVE
apt -y autoclean
" >"$1/oobe/setupComplete/00-packages"
chmod +x "$1/oobe/setupComplete/00-packages"

View File

@ -0,0 +1,2 @@
#!/bin/bash
export WDVN_PACKAGES="$WDVN_PACKAGES sudo"

View File

@ -1,3 +0,0 @@
#!/bin/bash
export OPUS_PACKAGES="$OPUS_PACKAGES xorg xfce4 xfce4-*-plugin xfce4-power-manager gvfs gvfs-backends gvfs-fuse network-manager-gnome xfce4-terminal xfce4-screenshooter mousepad netsurf-gtk xautolock xsecurelock qt5-style-plugins alsa-utils synaptic epiphany-browser"
export OPUS_PACKAGES_REMOVE="$OPUS_PACKAGES_REMOVE xscreensaver"

View File

@ -0,0 +1,2 @@
#!/bin/bash
find "$1" -name ".wdvn-placeholder" -type f -delete

View File

@ -0,0 +1,12 @@
#!/bin/bash
echo "deb $WDVN_URL $WDVN_VER main contrib non-free
# deb-src $WDVN_URL $WDVN_VER main contrib non-free
deb $WDVN_URL $WDVN_VER-security main contrib non-free
# deb-src $WDVN_URL $WDVN_VER-security main contrib non-free
# chimaera-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates>
# deb $WDVN_URL $WDVN_VER-updates main contrib non-free
# deb-src $WDVN_URL $WDVN_VER-updates main contrib non-free
" >"$1/etc/apt/sources.list"

View File

@ -1,2 +1,12 @@
#!/bin/bash
echo "$OPUS_SOURCES" >"$1/etc/apt/sources.list"
echo "deb $WDVN_URL $WDVN_VER main
# deb-src $WDVN_URL $WDVN_VER main
deb $WDVN_URL $WDVN_VER-security main
# deb-src $WDVN_URL $WDVN_VER-security main
# chimaera-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates>
# deb $WDVN_URL $WDVN_VER-updates main
# deb-src $WDVN_URL $WDVN_VER-updates main
" >"$1/etc/apt/sources.list"

111
notes Normal file
View File

@ -0,0 +1,111 @@
- to get packages, and their size in kb: dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n
- to get package's files: dpkg -L package
- to get folder size: du -hs directory
31M /usr/share/locale
13M /usr/share/doc
21M apt remove apt tzdata libgnutls30 grep diffutils findutils e2fsprogs libapt-pkg6.0
default packages in devuan minbase:
26 libaudit-common
34 libtirpc-common
36 libsemanage-common
47 libcap-ng0
49 hostname
49 lsb-base
50 libkeyutils1
52 libattr1
56 libffi7
64 devuan-keyring
65 startpar
73 libdebconfclient0
74 libacl1
77 sysvinit-utils
81 sysv-rc
88 bootlogd
93 libcom-err2
93 logsave
104 libbz2-1.0
109 libss2
126 libnsl2
128 libtasn1-6
131 init-system-helpers
133 libxxhash0
134 libgcc-s1
143 libuuid1
154 libaudit1
157 insserv
160 liblz4-1
161 libseccomp2
169 zlib1g
171 libkrb5support0
176 initscripts
195 libgpg-error0
223 debianutils
224 dash
226 libselinux1
232 libeudev1
234 debian-archive-keyring
234 libpam-modules-bin
242 base-passwd
245 gzip
248 libtirpc3
250 libcrypt1
252 libpam0g
253 mawk
261 gcc-10-base
262 gcc-9-base
272 sysvinit-core
292 liblzma5
304 libidn2-0
307 libk5crypto3
336 libsemanage1
362 libsmartcols1
378 base-files
385 ncurses-base
415 bsdutils
452 mount
453 libhogweed6
471 libblkid1
480 libgssapi-krb5-2
491 libnettle8
517 debconf
518 libtinfo6
539 libmount1
634 ncurses-bin
639 libext2fs2
685 libpcre3
687 libpcre2-8-0
849 adduser
849 libsepol1
864 libzstd1
886 sed
922 libgmp10
961 gpgv
965 libpam-runtime
1084 libpam-modules
1098 grep
1124 libgcrypt20
1126 libkrb5-3
1530 libp11-kit0
1579 e2fsprogs
1591 libunistring2
1606 diffutils
1993 findutils
2032 libdb5.3
2326 login
2344 libstdc++6
2746 passwd
3224 tar
3297 libgnutls30
3409 tzdata
3448 libapt-pkg6.0
3567 libc-bin
3959 libssl1.1
4269 apt
4609 util-linux
6597 bash
7091 dpkg
7934 perl-base
12217 libc6
17657 coreutils

View File

@ -1,22 +0,0 @@
#!/usr/bin/env bash
set -e
if [ -f "$1/data/bin/login" ]; then
if [ -f "$2/bin/login.bak" ]; then
rm "$2/bin/login"
else
mv "$2/bin/login" "$2/bin/login.bak"
fi
fi
if [ -d "$1/data" ]; then
cp -rf "$1/data/." "$2"
fi
if [ -f "$2/chroot" ]; then
fchroot "$2" "/chroot"
rm "$2/chroot"
fi
if [ -f "$1/modscript" ]; then
source "$1/modscript" "$2"
fi

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
set -e
export OPUS_ARCH=amd64
export OPUS_LINUX=linux-image-amd64

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
set -e
export OPUS_ARCH=i386
export OPUS_LINUX=linux-image-686

View File

@ -1,14 +0,0 @@
#!/usr/bin/env bash
set -e
export OPUS_SOURCES="deb http://deb.devuan.org/merged $OPUS_DIST main contrib non-free
# deb-src http://deb.devuan.org/merged $OPUS_DIST main contrib non-free
deb http://pkgmaster.devuan.org/merged $OPUS_DIST-security main contrib non-free
# deb-src http://pkgmaster.devuan.org/merged $OPUS_DIST-security main contrib non-free
# chimaera-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates>
# deb http://deb.devuan.org/merged $OPUS_DIST-updates main contrib non-free
# deb-src http://deb.devuan.org/merged $OPUS_DIST-updates main contrib non-free
"
export OPUS_NAME="opus-dvn-proprietary"

View File

@ -1,8 +0,0 @@
#!/usr/bin/env bash
set -e
mount -o bind "/dev" "$1/dev"
mount -o bind "/dev/pts" "$1/dev/pts"
mount -o bind "/sys" "$1/sys"
mount -o bind "/proc" "$1/proc"
chroot "$1" ${@:2}
fchroot-end "$1"

View File

@ -1,5 +0,0 @@
#!/usr/bin/env bash
umount -l "$1/proc"
umount -l "$1/sys"
umount -l "$1/dev/pts"
umount -l "$1/dev"

View File

@ -1,9 +0,0 @@
#!/usr/bin/env bash
set -e
if [ -d "$1" ]; then
rm -rf "$1"
fi
mkdir "$1"
debootstrap --arch="$OPUS_ARCH" "$OPUS_DIST" "$1" "$OPUS_URL"
fchroot "$1" apt -y autoclean
find "$1/var/log" -type f -delete

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
set -e
cd "$OPUS_IMAGEDIR"
tar -czvf "$2"

View File

@ -1,75 +0,0 @@
#!/usr/bin/env bash
set -e
export DISK_IMAGE="$2"
export ROOT_MOUNT="$1-mount"
set +e
(
set -e
# Get the approximate size required for the image
export DISK_SIZE=$(du -sb "$1" | cut -f1)
# Add 256MB for SWAP, and 700MB for overhead
export DISK_SIZE=$(( $DISK_SIZE + ( 256 * 1000000 ) + ( 700 * 1000000 ) ))
# Create and mount disk
fallocate -l $DISK_SIZE "$DISK_IMAGE"
export DISK_LOOP="$(losetup --show -f -P "$DISK_IMAGE")"
# Partition disk
(
echo n
echo e
echo
echo
echo +256M
echo t
echo swap
echo n
echo p
echo
echo
echo
echo t
echo
echo linux
echo w
echo
echo
) | fdisk "$DISK_LOOP"
# Format partions
mkswap "${DISK_LOOP}p1"
mkfs.ext4 "${DISK_LOOP}p2"
# Mount root
mkdir "$ROOT_MOUNT"
mount "${DISK_LOOP}p2" "$ROOT_MOUNT"
# Add files
cp -a "$1/." "$ROOT_MOUNT"
# Make fstab
echo "UUID=$(blkid -o value -s UUID "${DISK_LOOP}p1") none swap sw 0 0" >"$ROOT_MOUNT/etc/fstab"
echo "UUID=$(blkid -o value -s UUID "${DISK_LOOP}p2") / ext4 errors=remount-ro 0 1" >>"$ROOT_MOUNT/etc/fstab"
# Set up GRUB and misc
fchroot "$ROOT_MOUNT" "/setupdisk"
# Clear logs
find "$ROOT_MOUNT/var/log" -type f -delete
# Unmount root
umount -l "$ROOT_MOUNT"
rmdir "$ROOT_MOUNT"
losetup -d "$DISK_LOOP"
)
if [ $? != 0 ]; then
echo
echo Script execution ended due to error. Cleaning up...
umount -l "$ROOT_MOUNT"
rmdir "$ROOT_MOUNT"
losetup -d "$DISK_LOOP"
echo Script execution ended due to error.
exit 1
fi

14
path/wdvn-chroot Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
(
set -e
mount -o bind "/dev" "$1/dev"
mount -o bind "/dev/pts" "$1/dev/pts"
mount -t proc none "$1/proc"
chroot "$1" ${@:2}
)
if [ $? != 0 ]; then
wdvn-chroot-end "$1"
exit 1
fi
wdvn-chroot-end "$1"

4
path/wdvn-chroot-end Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
umount -l "$1/proc"
umount -l "$1/dev/pts"
umount -l "$1/dev"

3
path/wdvn-clean Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
wdvn-chroot "$1" apt -y autoclean
find "$1/var/log" -type f -delete

3
path/wdvn-get Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
set -e
debootstrap --arch="$WDVN_ARCH" "$WDVN_VER" "$1" "$WDVN_URL"

3
path/wdvn-image-gz Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
set -e
GZIP=-9 tar -czvf "$2" -C "$1" .

94
path/wdvn-image-iso Executable file
View File

@ -0,0 +1,94 @@
#!/bin/bash
set -e
DISC_NAME="$WDVN_NAME $WDVN_ARCH $WDVN_VER $WDVN_DATE"
CHROOT="$1"
IMAGE="$2.tmp"
if [ -d "$IMAGE" ]; then
rm -r -f "$IMAGE"
fi
EXIT=0
if [ ! -d "/usr/lib/ISOLINUX" ]; then
echo "ERROR: /usr/lib/ISOLINUX not found. Run 'apt install isolinux'."
EXIT=1
fi
if [ ! -d "/usr/lib/syslinux" ]; then
echo "ERROR: /usr/lib/syslinux not found. Run 'apt install syslinux-common'."
EXIT=1
fi
if [ ! -d "$CHROOT/lib/live/boot" ]; then
echo "ERROR: /lib/live/boot not found within chroot. On your chroot, run 'apt install live-boot'."
EXIT=1
fi
if [ ! -f "$CHROOT/usr/share/initramfs-tools/hooks/live" ]; then
echo "ERROR: /usr/share/initramfs-tools/hooks/live not found within chroot. On your chroot, run 'apt install live-boot-initramfs-tools'."
EXIT=1
fi
if ! command -v xorriso &> /dev/null
then
echo "ERROR: xorriso not found. Run 'apt install xorriso'."
EXIT=1
fi
if [ -f "$2" ]; then
echo "ERROR: $2 already exists."
EXIT=1
fi
if [ "$EXIT" == "1" ]; then
exit 1
fi
mkdir -p "$IMAGE"
mkdir -p "$IMAGE/live"
mkdir -p "$IMAGE/isolinux"
cp -fv "$CHROOT/boot"/vmlinuz-* "$IMAGE/live/vmlinuz"
cp -fv "$CHROOT/boot"/initrd.img-* "$IMAGE/live/initrd.img"
mksquashfs "$CHROOT" "$IMAGE/live/filesystem.squashfs"
echo "UI menu.c32
MENU TITLE $WDVN_NAME $WDVN_ARCH $WDVN_VER $WDVN_DATE live
TIMEOUT 600
LABEL linux
MENU LABEL Linux
KERNEL /live/vmlinuz
APPEND initrd=/live/initrd.img boot=live noautologin
LABEL linux-nomodeset
MENU LABEL Linux (nomodeset)
KERNEL /live/vmlinuz
APPEND initrd=/live/initrd.img boot=live noautologin nomodeset
" > "$IMAGE/isolinux/isolinux.cfg"
cp /usr/lib/ISOLINUX/isolinux.bin "$IMAGE/isolinux/"
cp /usr/lib/syslinux/modules/bios/* "$IMAGE/isolinux/"
xorriso \
-as mkisofs \
-iso-level 3 \
-full-iso9660-filenames \
-volid "$DISC_NAME" \
-output "$2" \
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
-eltorito-boot \
isolinux/isolinux.bin \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
--eltorito-catalog isolinux/isolinux.cat \
"$IMAGE"
# -eltorito-alt-boot \
# -e /EFI/boot/efiboot.img \
# -no-emul-boot \
# -isohybrid-gpt-basdat \
# -append_partition 2 0xef EFI/boot/efiboot.img \
# "$IMAGE"

88
path/wdvn-image-iso (copy 1) Executable file
View File

@ -0,0 +1,88 @@
#!/bin/bash
# https://gist.github.com/Sirherobrine23/6d680d3027a0b032fb950b1770f03a45
set -e
set -x
DISC_NAME="Linux"
CHROOT="$1"
IMAGE="$2.tmp"
OLDPWD="$(pwd)"
mkdir -p "$IMAGE/casper"
mkdir -p "$IMAGE/isolinux"
# Boot
cp -fv "$CHROOT/boot"/vmlinuz-* "$IMAGE/casper/vmlinuz"
cp -fv "$CHROOT/boot"/initrd.img-* "$IMAGE/casper/initrd"
# ------
#
chroot "$CHROOT" dpkg-query -W --showformat='${Package} ${Version}\n' | tee "$IMAGE/casper/filesystem.manifest"
cp -v "$IMAGE/casper/filesystem.manifest" "$IMAGE/casper/filesystem.manifest-desktop"
sed -i '/ubiquity/d' "$IMAGE/casper/filesystem.manifest-desktop"
sed -i '/casper/d' "$IMAGE/casper/filesystem.manifest-desktop"
sed -i '/discover/d' "$IMAGE/casper/filesystem.manifest-desktop"
sed -i '/laptop-detect/d' "$IMAGE/casper/filesystem.manifest-desktop"
sed -i '/os-prober/d' "$IMAGE/casper/filesystem.manifest-desktop"
# Create read-only
if [ -e "$IMAGE/casper/filesystem.squashfs" ];then
rm -rfv "$IMAGE/casper/filesystem.squashfs"
fi
mksquashfs "$CHROOT" "$IMAGE/casper/filesystem.squashfs"
# squashFS Size
printf $(du -sx --block-size=1 "$CHROOT" | cut -f1) > "$IMAGE/casper/filesystem.size"
# IMAGE DIR
# --------
# README.diskdefines
echo "#define DISKNAME $DISC_NAME
#define TYPE binary
#define TYPEbinary 1
#define ARCH amd64
#define ARCHamd64 1
#define DISKNUM 1
#define DISKNUM1 1
#define TOTALNUM 0
#define TOTALNUM0 1" > "$IMAGE/README.diskdefines"
echo 'UI menu.c32
MENU TITLE Boot Menu
DEFAULT linux
TIMEOUT 600
LABEL linux
MENU LABEL windvn live
MENU DEFAULT
KERNEL /casper/vmlinuz
APPEND initrd=/casper/initrd boot=casper selinux=disabled
LABEL linux
MENU LABEL windvn live (nomodeset)
MENU DEFAULT
KERNEL /casper/vmlinuz
APPEND initrd=/casper/initrd boot=casper selinux=disabled nomodeset
' > "$IMAGE/isolinux/isolinux.cfg"
cp /usr/lib/ISOLINUX/isolinux.bin "$IMAGE/isolinux/"
cp /usr/lib/syslinux/modules/bios/* "$IMAGE/isolinux/"
xorriso \
-as mkisofs \
-iso-level 3 \
-full-iso9660-filenames \
-volid "$DISC_NAME" \
-output "$2" \
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
-eltorito-boot \
isolinux/isolinux.bin \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
--eltorito-catalog isolinux/isolinux.cat \
"$IMAGE"
# -eltorito-alt-boot \
# -e /EFI/boot/efiboot.img \
# -no-emul-boot \
# -isohybrid-gpt-basdat \
# -append_partition 2 0xef EFI/boot/efiboot.img \
# "$IMAGE"

12
path/wdvn-make Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
set -e
mkdir -p "$1"
wdvn-get "$1"
for WDVN_MODLIST in "${@:2}"
do
while IFS="" read -r WDVN_LINE || [ -n "$WDVN_LINE" ]
do
source wdvn-mod "mods/$WDVN_LINE" "$1"
done < "modlists/$WDVN_MODLIST"
done
wdvn-clean "$1"

14
path/wdvn-mod Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
set -e
if [ -f "$1/modscript" ]; then
source "$1/modscript" "$2"
fi
if [ -d "$1/data" ]; then
cp --reflink=auto -rf "$1/data/." "$2"
fi
if [ -f "$2/chroot" ]; then
wdvn-chroot "$2" "/chroot"
rm "$2/chroot"
fi

2
path/wdvn-test Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
exit

32
shell
View File

@ -1,25 +1,11 @@
#!/bin/bash
set -e
alias cp="cp --reflink=auto"
export OPUS_NAME="opus-dvn"
export OPUS_HOME="$(dirname "$(realpath -s "$BASH_SOURCE")")"
export PATH="$OPUS_HOME/path:$PATH"
export OPUS_PID="$BASHPID"
export OPUS_OUTPUT="$OPUS_HOME/chroots"
export OPUS_URL="http://deb.devuan.org/merged"
export OPUS_DIST="chimaera"
export OPUS_SOURCES="deb http://deb.devuan.org/merged $OPUS_DIST main
# deb-src http://deb.devuan.org/merged $OPUS_DIST main
export WDVN_NAME="windvn"
export WDVN_URL="http://deb.devuan.org/merged"
export WDVN_VER="chimaera"
export WDVN_ARCH="i386"
export WDVN_KERNEL="linux-image-686"
deb http://pkgmaster.devuan.org/merged $OPUS_DIST-security main
# deb-src http://pkgmaster.devuan.org/merged $OPUS_DIST-security main
# chimaera-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates>
# deb http://deb.devuan.org/merged $OPUS_DIST-updates main
# deb-src http://deb.devuan.org/merged $OPUS_DIST-updates main
"
export PS1="\[\033[0;35m\]\$OPUS_NAME \$OPUS_ARCH \[\033[0m\]- \[\033[0;37m\]\$PWD\[\033[0m\]: "
env
echo ""
echo "Environment expanded."
export WDVN_DATE="$(date "+%Y.%m.%d-%H.%M.%S")"
export WDVN_PID="$BASHPID"
export PATH="$(dirname "$(realpath -s "$BASH_SOURCE")")/path:$PATH"
export PS1="\[\033[0;35m\]\$WDVN_NAME-\${WDVN_ARCH}_\${WDVN_VER}_\$WDVN_DATE\[\033[0m\]:\[\033[0;37m\]\$(basename -- \$PWD)\[\033[0m\]> "