mirror of
https://github.com/commaai/agnos-builder.git
synced 2026-08-22 08:44:01 +08:00
cleanup
This commit is contained in:
@@ -1,19 +1,13 @@
|
||||
[Unit]
|
||||
Description=Create Volatile Files and Directories
|
||||
Description=tmpfiles setup handled by comma-init
|
||||
Documentation=man:tmpfiles.d(5) man:systemd-tmpfiles(8)
|
||||
DefaultDependencies=no
|
||||
After=comma-init.service systemd-sysusers.service systemd-journald.service
|
||||
Before=sysinit.target shutdown.target initrd-switch-root.target
|
||||
Conflicts=shutdown.target initrd-switch-root.target
|
||||
RefuseManualStop=yes
|
||||
After=comma-init.service
|
||||
Before=sysinit.target shutdown.target
|
||||
Conflicts=shutdown.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev --exclude-prefix=/etc --exclude-prefix=/tmp --exclude-prefix=/var/tmp
|
||||
SuccessExitStatus=DATAERR CANTCREAT
|
||||
ImportCredential=tmpfiles.*
|
||||
ImportCredential=login.motd
|
||||
ImportCredential=login.issue
|
||||
ImportCredential=network.hosts
|
||||
ImportCredential=ssh.authorized_keys.root
|
||||
# Preserve ordering for units with After=systemd-tmpfiles-setup.service.
|
||||
ExecStart=/bin/true
|
||||
|
||||
@@ -161,10 +161,14 @@ function init_filesystems (
|
||||
/var/lib/dpkg \
|
||||
/var/lib/logrotate \
|
||||
/var/spool/cron/atjobs \
|
||||
/var/cache/pollinate
|
||||
/var/cache/pollinate \
|
||||
/run/lock/subsys
|
||||
touch \
|
||||
/var/lib/dpkg/lock-frontend \
|
||||
/var/lib/dpkg/status
|
||||
rm -rf /var/run /var/lock
|
||||
ln -s ../run /var/run
|
||||
ln -s ../run/lock /var/lock
|
||||
chmod 1777 /var/tmp
|
||||
chown pollinate:daemon /var/cache/pollinate
|
||||
|
||||
|
||||
@@ -36,10 +36,14 @@ function is_modem_sysfs {
|
||||
}
|
||||
|
||||
function setup_modem_ttys {
|
||||
local path name iface found i
|
||||
local path name iface usb vendor found quectel at0 at1 i
|
||||
|
||||
found=0
|
||||
quectel=0
|
||||
at0=0
|
||||
at1=0
|
||||
|
||||
for i in {0..300}; do
|
||||
found=0
|
||||
for path in /sys/class/tty/ttyUSB* /sys/class/tty/ttyACM*; do
|
||||
[[ -e "$path" ]] || continue
|
||||
is_modem_sysfs "$path" || continue
|
||||
@@ -55,15 +59,20 @@ function setup_modem_ttys {
|
||||
iface="${iface%/*}"
|
||||
done
|
||||
|
||||
[[ -r "$iface/bInterfaceNumber" && -r "${iface%/*}/idVendor" ]] || continue
|
||||
[[ "$(< "${iface%/*}/idVendor")" == "2c7c" ]] || continue
|
||||
usb="${iface%/*}"
|
||||
[[ -r "$iface/bInterfaceNumber" && -r "$usb/idVendor" ]] || continue
|
||||
read -r vendor < "$usb/idVendor"
|
||||
[[ "$vendor" == "2c7c" ]] || continue
|
||||
quectel=1
|
||||
|
||||
case "$(< "$iface/bInterfaceNumber")" in
|
||||
02) ln -sfn "/dev/$name" /dev/modem_at0 ;;
|
||||
03) ln -sfn "/dev/$name" /dev/modem_at1 ;;
|
||||
02) ln -sfn "/dev/$name" /dev/modem_at0; at0=1 ;;
|
||||
03) ln -sfn "/dev/$name" /dev/modem_at1; at1=1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
((found)) && return
|
||||
((at0 && at1)) && return
|
||||
((found && !quectel)) && return
|
||||
sleep 0.01
|
||||
done
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user