👷 add testiso script

This commit is contained in:
Vladislav Nepogodin committed 2022-07-13 00:09:22 +04:00
1 parent d5c40142b2
commit b77f7dbc70
4 files changed
+190 -6

No files matched your search

Executable
+55
View File
@@ -0,0 +1,55 @@
#!/bin/bash
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
src_dir=$(pwd)
[[ -r ${src_dir}/util-msg.sh ]] && source ${src_dir}/util-msg.sh
ifs=$IFS
IFS="${IFS}:"
libdirs="/lib /usr/lib /usr/local/lib $(cat /etc/ld.so.conf.d/*)"
extras=
TMPDIR=$(mktemp -d --tmpdir lddd-script.XXXX)
msg 'Go out and drink some tea, this will take a while :) ...'
# Check ELF binaries in the PATH and specified dir trees.
for tree in $PATH $libdirs $extras; do
msg2 "DIR $tree"
# Get list of files in tree.
files=$(find $tree -type f ! -name '*.a' ! -name '*.la' ! -name '*.py*' ! -name '*.txt' ! -name '*.h' ! -name '*.ttf' ! \
-name '*.rb' ! -name '*.ko' ! -name '*.pc' ! -name '*.enc' ! -name '*.cf' ! -name '*.def' ! -name '*.rules' ! -name \
'*.cmi' ! -name '*.mli' ! -name '*.ml' ! -name '*.cma' ! -name '*.cmx' ! -name '*.cmxa' ! -name '*.pod' ! -name '*.pm' \
! -name '*.pl' ! -name '*.al' ! -name '*.tcl' ! -name '*.bs' ! -name '*.o' ! -name '*.png' ! -name '*.gif' ! -name '*.cmo' \
! -name '*.cgi' ! -name '*.defs' ! -name '*.conf' ! -name '*_LOCALE' ! -name 'Compose' ! -name '*_OBJS' ! -name '*.msg' ! \
-name '*.mcopclass' ! -name '*.mcoptype')
IFS=$ifs
for i in $files; do
if (( $(file $i | grep -c 'ELF') != 0 )); then
# Is an ELF binary.
if (( $(ldd $i 2>/dev/null | grep -c 'not found') != 0 )); then
# Missing lib.
echo "$i:" >> $TMPDIR/raw.txt
ldd $i 2>/dev/null | grep 'not found' >> $TMPDIR/raw.txt
fi
fi
done
done
grep '^/' $TMPDIR/raw.txt | sed -e 's/://g' >> $TMPDIR/affected-files.txt
# invoke pacman
for i in $(cat $TMPDIR/affected-files.txt); do
pacman -Qo $i | awk '{print $4,$5}' >> $TMPDIR/pacman.txt
done
# clean list
sort -u $TMPDIR/pacman.txt >> $TMPDIR/possible-rebuilds.txt
msg "Files saved to $TMPDIR"
Executable
+127
View File
@@ -0,0 +1,127 @@
#!/bin/bash
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
src_dir=$(pwd)
[[ -r ${src_dir}/util-msg.sh ]] && source ${src_dir}/util-msg.sh
import ${src_dir}/util.sh
# setting of the general parameters
work_dir="${src_dir}/build"
outFolder="${src_dir}/out"
if [ $# -eq 0 ]; then
msg "No <profile>"
msg2 "Usage: testiso <profile>"
exit 1
fi
vdi_size=10240 # 10GB size
#Check if already exist virtual disk and in case create it
if [[ -e ~/VirtualBox\ VMs/CachyOS/CachyOS.vbox ]]; then
msg "CachyOS Virtual Machine Found"
else
msg "We create a new VirtualBox Machine called CachyOS"
msg2 "We create a new Virtual Disk Image ( vdi ) with ${vdi_size}GB"
VBoxManage createmedium disk --filename ~/VirtualBox\ VMs/CachyOS/CachyOS.vdi --size ${vdi_size} --format VDI --variant Fixed
UUID=$(VBoxManage showhdinfo ~/VirtualBox\ VMs/CachyOS/CachyOS.vdi | awk 'NR == 1 {print $2}') #uuid of vdi disk
gui_lang=$(awk -F'[.=]' '/LANG/ {print $2}' /etc/locale.conf)
echo '<?xml version="1.0"?>
<!--
** DO NOT EDIT THIS FILE.
** If you make changes to this file while any VirtualBox related application
** is running, your changes will be overwritten later, without taking effect.
** Use VBoxManage or the VirtualBox Manager GUI to make changes.
-->
<VirtualBox xmlns="http://www.virtualbox.org/" version="1.16-linux">
<Machine uuid="{b146a487-eeff-48d1-a404-b1c15f077feb}" name="CachyOS" OSType="ArchLinux_64" snapshotFolder="Snapshots" lastStateChange="2022-07-11T14:59:41Z">
<MediaRegistry>
<HardDisks>
<HardDisk uuid="{UUID}" location="CachyOS.vdi" format="VDI" type="Normal"/>
</HardDisks>
</MediaRegistry>
<Hardware>
<CPU count="4">
<PAE enabled="false"/>
<LongMode enabled="true"/>
<X2APIC enabled="true"/>
<HardwareVirtExLargePages enabled="false"/>
</CPU>
<Memory RAMSize="7168"/>
<Firmware type="EFI"/>
<HID Pointing="USBTablet"/>
<Display VRAMSize="16" accelerate3D="true"/>
<VideoCapture file="." fps="25"/>
<BIOS>
<IOAPIC enabled="true"/>
<SmbiosUuidLittleEndian enabled="true"/>
</BIOS>
<USB>
<Controllers>
<Controller name="OHCI" type="OHCI"/>
</Controllers>
</USB>
<Network>
<Adapter slot="0" enabled="true" MACAddress="080027967634" type="82540EM">
<NAT/>
</Adapter>
</Network>
<AudioAdapter codec="AD1980" driver="Pulse" enabled="true" enabledIn="false"/>
<RTC localOrUTC="UTC"/>
<GuestProperties>
<GuestProperty name="/VirtualBox/HostInfo/GUI/LanguageID" value="gui_lang" timestamp="1566055357633717000" flags=""/>
</GuestProperties>
</Hardware>
<StorageControllers>
<StorageController name="IDE" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true">
<AttachedDevice passthrough="false" type="DVD" hotpluggable="false" port="1" device="0"/>
</StorageController>
<StorageController name="SATA" type="AHCI" PortCount="1" useHostIOCache="false" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3">
<AttachedDevice type="HardDisk" hotpluggable="false" port="0" device="0">
<Image uuid="{UUID}"/>
</AttachedDevice>
</StorageController>
</StorageControllers>
</Machine>
</VirtualBox>' > ~/VirtualBox\ VMs/CachyOS/CachyOS.vbox
sed -i "s/UUID/$UUID/g" ~/VirtualBox\ VMs/CachyOS/CachyOS.vbox
sed -i "s/gui_lang/$gui_lang/g" ~/VirtualBox\ VMs/CachyOS/CachyOS.vbox
VBoxManage registervm ~/VirtualBox\ VMs/CachyOS/CachyOS.vbox #register the cachyos vbox machine
fi
VBoxManage storageattach CachyOS --storagectl IDE --port 1 --device 0 --medium emptydrive #empty the dvd drive
sleep 1
iso_dir=$(find ${outFolder} -type d -iname "$1")
iso=${iso_dir}
if [[ -e $(ls ${iso}/*.iso) ]]; then
iso_name=$(ls ${iso}/*.iso)
else msg "No ISO to load present"
exit 1
fi
VBoxManage storageattach CachyOS --storagectl IDE --port 1 --device 0 --type dvddrive --medium $iso_name #attach dvd cachyos iso
sleep 1
msg2 "Run Vbox CachyOS with ${iso_name}"
sleep 2
VBoxManage startvm CachyOS #run vbox machine
+5 -4
View File
@@ -12,20 +12,21 @@
umount_img() {
if [[ -n ${IMG_ACTIVE_MOUNTS[@]} ]]; then
info "umount: [%s]" "${IMG_ACTIVE_MOUNTS[@]}"
umount "${IMG_ACTIVE_MOUNTS[@]}"
sudo umount "${IMG_ACTIVE_MOUNTS[@]}"
unset IMG_ACTIVE_MOUNTS
rm -r "$1"
fi
}
check_umount() {
if mountpoint -q "$1"
then
umount -l "$1"
if mountpoint -q "$1"; then
sudo umount -l "$1"
fi
}
umount_fs(){
FS_ACTIVE_MOUNTS=()
if [[ -n ${FS_ACTIVE_MOUNTS[@]} ]]; then
info "overlayfs umount: [%s]" "${FS_ACTIVE_MOUNTS[@]}"
#umount "${FS_ACTIVE_MOUNTS[@]}"
+3 -2
View File
@@ -101,9 +101,10 @@ run_build() {
msg "Start [Build ISO]"
[ -d $outFolder ] || mkdir $outFolder
[ -d "$outFolder/$_profile" ] || mkdir -p "$outFolder/$_profile"
cd ${work_dir}/archiso/
sudo mkarchiso -v -w ${work_dir} -o $outFolder ${work_dir}/archiso/
sudo mkarchiso -v -w ${work_dir} -o "$outFolder/$_profile" ${work_dir}/archiso/
sudo chown $USER $outFolder
cp ${work_dir}/iso/arch/pkglist.x86_64.txt $outFolder/$(gen_iso_fn).pkgs.txt
mv $outFolder/"cachyos-$(date +%Y.%m.%d)-x86_64.iso" $outFolder/${iso_file}